home *** CD-ROM | disk | FTP | other *** search
/ PC Media 15 / PC MEDIA CD15.iso / helpline / get27 / get27.doc < prev    next >
Encoding:
Text File  |  1987-11-26  |  244.5 KB  |  5,567 lines

  1.  
  2.  
  3. *********** Read and Remove this paragraph before printing ****************
  4.  
  5. NOTE: This file is formatted for printing on a laser printer using a utility
  6. such as Vern Buerg's LJBOOK laser jet booklet printing utility.  This will
  7. print 4 pages on one sheet of paper front and back thus forming a convenient
  8. book and conserving paper.  If you do not have a laser printer or do not use
  9. LJBOOK, it is suggested that you set your printer for 8 lines per inch,
  10. compressed type, and/or reduce the font point size if possible.
  11.  
  12. ******* Remove this paragraph after reading and before printing ***********
  13.  
  14.                                       
  15.                                       
  16.                                       
  17.                                       
  18.                                       
  19.                                       
  20.                                       
  21.                                       
  22.                                       
  23.                                       
  24.                                 USER MANUAL
  25.                                       
  26.                                     and
  27.                                       
  28.                           COMMAND REFERENCE GUIDE
  29.                                       
  30.                                     for
  31.                                       
  32.                                   GET.EXE
  33.                                       
  34.                      Bob Stephan's Batch File Enhancer
  35.                                       
  36.                                 Version 2.7
  37.                                       
  38.                                 Release 2.70
  39.                                       
  40.                             Manual revision date
  41.                                 May 29, 1995
  42.                                       
  43.                          Copyright Bob Stephan 1995
  44.                             All Rights Reserved
  45.  
  46.  
  47.  
  48.  
  49.           
  50.           
  51.           
  52.           
  53.           This software and user's guide are Copyright 1995 by Bob Stephan
  54.           and Moby Disk, ALL RIGHTS RESERVED.  They are protected by both
  55.           United States copyright law and international treaty provisions.
  56.           
  57.           Edition revision date May 29
  58.           
  59.           Moby Disk is an acronym for MOnterey BaY DISK Data Systems, both
  60.           of which are registered business names of Bob Stephan.  Bob
  61.           Stephan reserves the right to make changes to this document
  62.           without notice.
  63.                                       
  64.                                  Moby Disk
  65.                             1021 San Carlos Road
  66.                           Pebble Beach  CA  93953
  67.                                       
  68.                             Phone: 408-646-1899
  69.                               FAX: On request
  70.                            CompuServe: 72357,2276
  71.                           America Online: MobyDisk2
  72.                      Internet: bob.stephan@nitelog.com
  73.                         CRICKET BBS: (408) 373-3773
  74.                         NITELOG BBS: (408) 655-1096
  75.                                       
  76.                                       
  77.           IBM, Microsoft, Windows, DESQview, DR DOS, MS-DOS, PC-DOS and 4DOS
  78.           are trademarks of their respective companies.  This document was
  79.           produced using XyWrite 4.0, a product of The Technology Group.
  80.  
  81.  
  82.  
  83.  
  84. GET.DOC              GET Version 2.7              Copyright 1995 Bob Stephan
  85.  
  86.                                   READ.ME
  87.  
  88. GET.EXE is a general purpose DOS BATch file enhancer.  It makes information
  89. available to the BATch file through the BATch IF subcommand.  The
  90. information can come from user input or from the operating system, and it is
  91. made available to the BATch file through the DOS ErrorLevel (Exit Code) as
  92. well as variables in the DOS Environment. GET also has capabilities to set
  93. some system parameters and perform a few other specific actions, over 50
  94. functions in all.  Not only is GET wonderful for automating your personal
  95. system, it is excellent for client support and software installation
  96. programs. If you have been using an older version of GET, you will also be
  97. interested in the information in GET27NEW.DOC to help focus on the new and
  98. improved features.
  99.   
  100. LICENSING SUMMARY
  101.  
  102. GET is copyrighted software and is not in the public domain!  The shareware
  103. version may be used for limited evaluation period after which time
  104. registration is required to obtain a license for continued use.
  105.  
  106. GET is released as shareware with a requested registration fee of $15 plus
  107. $2 shipping and handling to U.S.A, Canada, or Mexico, or $4 to other
  108. countries. The full manual can be included with new registrations or ordered
  109. later by registered users for $8 plus S&H as above.  These prices are
  110. subject to change.  Registered users will be able to obtain upgrades at very
  111. reasonable prices.  See ORDER.GET for additional pricing information.
  112. (California residents please add applicable sales tax.)
  113.  
  114. There are conditions imposed on the distribution of copies of GET.  Please
  115. read this information and the section on Licensing and Distribution to be
  116. sure you are not using GET illegally.  The only version of GET that is free
  117. for an evaluation period is the one that displays the help screen when the
  118. name GET is entered at the DOS prompt by itself.  If you have one that says
  119. it is licensed and you have not registered, you have a pirated copy that is
  120. protected by law.
  121.  
  122. VENDORS, CORPORATE, and COMMERCIAL users see licensing terms under Licensing
  123. and Distribution.
  124.  
  125. INDIVIDUALS, SHAREWARE AUTHORS, and SYSOPS.  This version of GET is free for
  126. a limited evaluation period. Shareware authors who register GET may use it
  127. in distributing their products subject to the conditions specified in the
  128. Licensing and Distribution terms below.  GET.EXE may be freely copied and
  129. distributed provided that all files in the GET package, including but not
  130. limited to all the .DOC files, are included on the disk or in the compressed
  131. file with GET.EXE.  Registrations and contributions to support this
  132. development project will be gratefully accepted.
  133.  
  134. If you send the registration fee prescribed above (or more) plus the
  135. appropriate shipping and handling fee (see the ORDER.GET file) and
  136. appropriate sales tax you will receive the following benefits:
  137.   The latest version of GET with any new features.
  138.   A licensed runtime version to distribute with your BATch files.
  139.   A single user license with no royalties for non-commercial use.
  140.   An option to purchase the user manual giving examples and explanations.
  141.   Free support by BBS, mail, phone, CompuServe, or America Online (see below).
  142.   Notification of new releases and upgrades when available.
  143.   Reduced prices for upgrading to new versions.
  144.  
  145.  
  146.  
  147.  
  148. Page iv                            READ.ME                           GET 2.7
  149.  
  150. AVAILABILITY
  151.  
  152. Various versions of GET are available on many electronic bulletin board
  153. systems worldwide, and on the various commercial on-line systems such as
  154. CompuServe, America On Line, and GENIE.
  155.  
  156. The latest shareware versions are always available for first time downloads
  157. on the following two boards on the Monterey Penninsula in California:
  158.  
  159.         NITELOG 408-655-1096
  160.         CRICKET 408-373-3773
  161.    A brief BBS registration is required for first time callers.
  162.  
  163. FIDONET:  GET is available from FIDONET BFDS (Batch File Distribution
  164. System) sites.  It can also be FREQ'd from Nitelog for those with FIDONET
  165. File REQuest access.
  166.  
  167. Various versions of GET are also available at many FTP sites for those with
  168. Internet access.
  169.  
  170. REGISTRATION. Registrations in U.S. funds by check, cash, money order, or
  171. purchase order can be mailed to the below address.
  172.  
  173. VISA or MASTERCARD orders accepted by phone, or via NITELOG BBS. Enter S for
  174. Script, then 3 for Script 3 and complete the order form.
  175.  
  176. COMPUSERVE. GET is available for Shareware registration on CompuServe.  Just
  177. GO SWREG and place your order.  The latest version is available in IBM PC
  178. Utilities (GO PCUTIL).
  179.  
  180. SITE LICENSING. Site licensing applies to the number of concurrent users
  181. within an organization that are authorized to be using BATch files which
  182. require GET, such as on a network.  The prices listed are for the maximum
  183. number of concurrent users in each bracket.
  184.  
  185. DISTRIBUTION LICENSING. Distribution licensing can be ordered in conjunction
  186. with a site or multiple use license solely for placing copies of the runtime
  187. module on diskettes for the purpose of distributing software.  This license
  188. does not include the continued use of GET after the distributed software is
  189. installed on the target computer.  These prices are solely for making
  190. additional copies of the runtime module to place on diskettes, and they do
  191. not include any documentation or additional copies of the software.  The
  192. initial copy of the software must be obtained by licensing according to the
  193. above schedule for the number of concurrent users/developers at your
  194. site(s).  If you are a licensed user of GET and are ordering additional
  195. manuals or licenses, please enter your original serial or invoice number.
  196.  
  197. Questions, comments, and suggestions are always welcome. Contact us at:
  198.     MOBY DISK: 1021 San Carlos Road, Pebble Beach, CA 93953
  199.   Phone: (408) 646-1899  COMPUSERVE:72357,2276  America Online: MobyDisk2
  200.   Internet: bob.stephan@nitelog.com             BBS: Nitelog 408-655-1096
  201.   BBS: The Cricket 408-373-3773       /s/ Bob Stephan        May 29, 1995
  202.  
  203.  
  204.  
  205.  
  206. GET 2.7                       Table of Contents                       Page v
  207.  
  208.                                       
  209.                              Table of Contents
  210. READ.ME..................................................................iii
  211. LICENSING SUMMARY........................................................iii
  212.   Vendors, Corporate, and Commercial Users...............................iii
  213.   Individuals, Shareware Authors, and SYSOPS.............................iii
  214. AVAILABILITY..............................................................iv
  215. REGISTRATION and LICENSING................................................iv
  216. INTRODUCTION...............................................................1
  217. SYSTEM REQUIREMENTS........................................................1
  218. ACKNOWLEDGMENTS............................................................1
  219. ABOUT THE AUTHOR...........................................................2
  220. LIMITED WARRANTY (and other legalities)....................................2
  221. COPYRIGHT DISPLAY..........................................................2
  222. HELP SCREENS...............................................................3
  223. SYNTAX EXPLANATIONS........................................................5
  224.   Command..................................................................5
  225.   Argument(s)..............................................................5
  226.     [] brackets............................................................5
  227.     "" double quotes.......................................................5
  228.     filespec...............................................................5
  229.     chars..................................................................5
  230.     num, div...............................................................5
  231.   $num.........................Hexadecimal Notation........................5
  232.   #..............................ASCII Numbers.............................6
  233.   Environment..............................................................6
  234.   ErrorLevel...............................................................6
  235.   Extended.................................................................6
  236.   Surrogates...............................................................6
  237.   Switches.................................................................7
  238.   Kilobytes................................................................7
  239. ENTERING COMMANDS..........................................................7
  240. DEBUGGING..................................................................8
  241. SEE HOW IT RUNS............................................................8
  242. ERRORLEVEL.................................................................9
  243. SWITCHES AND SUCH.........................................................11
  244. GLOBAL SWITCHES...........................................................11
  245.   /B.........................Flush Keyboard Buffer........................11
  246.   /H..............................Hex Output..............................11
  247.   /L...............................Lowercase..............................11
  248.   /M..........................Master Environment..........................11
  249.   /R...........................Numerical Result...........................11
  250.   /TR..............................Trim Right.............................12
  251.   /TL..............................Trim Left..............................12
  252.   /T.................................Trim.................................12
  253.   /U...............................Uppercase..............................12
  254.   /V.............................Variable Name............................12
  255. LOCAL SWITCHES............................................................13
  256.   /A...........................Prompt Attribute...........................13
  257.   /C..........................Suppress Ctrl-Break.........................14
  258.   /E.............................Enhanced Keys............................14
  259.   /K...............................Kountdown..............................14
  260.   /N.................................No CR................................14
  261.   /S.............................Sound Control............................14
  262.   /W............................Wait or Number............................14
  263.   /X....................Extended Keys or eXtra function...................15
  264. USING GET COMMANDS........................................................16
  265. STRING HANDLING AND SCREEN I/O............................................16
  266.  
  267.  
  268.  
  269.  
  270. Page vi                       Table of Contents                      GET 2.7
  271.  
  272.                                       
  273.   GET C...........................GET Character...........................20
  274.   GET N.........................GET yes/no aNswer.........................23
  275.   GET T............................Moving Text............................25
  276.   GET S.............................GET String............................27
  277.   GET I..........................Check Key Buffer.........................30
  278.   GET EC...............................Echo...............................32
  279.   GET Z..........................Put String (Zap).........................33
  280.   GET ZE..........................Standard Input..........................38
  281.   GET #..........................Locate Substring.........................40
  282.   GET R.............................'Rithmetic............................42
  283.   GET B........................Clear (Blank) Screen.......................46
  284.   GET V.........................Get/set video mode........................48
  285.   GET VE.......................Get/set video border.......................49
  286.   GET H...........................Date and Time...........................50
  287.   GET U..........................Keyboard BUffer..........................57
  288.   GET UE............................Shift Locks...........................59
  289. GET DISK and FILE Information.............................................60
  290.   GET K........................Get disk free space........................62
  291.   GET Q.....................Get Disk Capacity (Quota).....................64
  292.   GET L..........................Get volume label.........................66
  293.   GET LE........................Match volume label........................68
  294.   GET F...........................Get file size...........................69
  295.   GET F /E..........................Get file date.........................74
  296.   GET FP...........................Get Full Path..........................76
  297.   GET X..........................Execute Program..........................78
  298.   GET XE............................GET's Path............................79
  299.   GET Y........................Drive and Directory........................80
  300.   GET YE.........................Logged/Boot Drive........................80
  301. GET MEMORY and SYSTEM Information.........................................82
  302.   GET BR........................Get/Set Break Flag........................82
  303.   GET P.......................Check for Printer(PRN)......................84
  304.   GET PE......................Initialize Printer(PRN).....................84
  305.   GET E........................Get Environment Size.......................86
  306.   GET M..........................Get Memory Free..........................88
  307.   GET D..........................Get DOS Version..........................89
  308.   GET DV.........................DESQview Version.........................90
  309.   GET 7.........................Check Coprocessor.........................91
  310.   GET 7E..........................Check CPU Type..........................91
  311.   GET 4........................4DOS/Windows Status........................92
  312.   GET 4E.......................Check Windows Status.......................92
  313.   GET A.........................Check for ANSI.SYS........................94
  314.   GET AE.....................Check for ROM BIOS Model.....................94
  315.   GET W...........................Warm/Cold Boot..........................95
  316. The Environment and Shells................................................96
  317. Out of Environment Space..................................................96
  318. PROGRAM INFORMATION.......................................................98
  319. RUNTIME Version for Registered users......................................98
  320. LICENSING AND DISTRIBUTION................................................98
  321.   Corporate Users.........................................................99
  322.   SYSOPs, User Groups, and Shareware authors..............................99
  323.   Vendors.................................................................99
  324.   Registered Users........................................................99
  325. SPECIAL OFFER............................................................100
  326. Appendix A.......................ASCII and Scan Codes......................A
  327.  
  328.  
  329.  
  330.  
  331.                                   GET.EXE
  332.                                       
  333.                      Bob Stephan's Batch File Enhancer
  334.                                       
  335.                                 Version 2.7
  336.                                       
  337. INTRODUCTION
  338.  
  339. BATch programming can make your computing life easier.  BATch programming
  340. with GET can make your BATch programming much easier and more productive.
  341. Most versions of DOS do not support a wide variety of useful features in the
  342. BATch programming commands that are available.  GET supplements these
  343. commands, and gives BATch the capabilities it needs to really do a proper
  344. job as a macro language.
  345.  
  346. GET provides additional commands in three general areas:
  347.  
  348.        String Handling and Screen I/O Commands
  349.        Disk and File Commands
  350.        Memory and System Commands
  351.  
  352. The commands are fully described herein, along with some general information
  353. on BATch programming and the use of ErrorLevel and the DOS Environment.
  354. However, this is not a BATch programming tutorial or primer.  Many useful
  355. books and publications can give you startup help if you need it.  Among
  356. those that I am familiar with are books by Nick Anis and Craig Menefee,
  357. Ronny Richardson, and "DOS Power Tools."
  358.  
  359. SYSTEM REQUIREMENTS
  360.   
  361. GET is compatible with all computers running DR, MS or PC-DOS Versions 2.0
  362. and later, although versions later than MS-DOS 3.1 or equivalent are
  363. preferred and some features require 5.0 or later. It is also compatible with
  364. OS/2 DOS emulation.  It requires only about 15Kb of memory to run and is
  365. stored on disk in a compressed format that is about 7Kb.  It is not memory
  366. resident (TSR) and will not reduce the amount of memory available to other
  367. programs.  It supports all types of monitors and display adapters whether
  368. monochrome or color.
  369.                                                             
  370. To support the many features of GET it is preferable if you are running DOS
  371. 5.0 or later.  A few of the features may not work on earlier versions, or
  372. with some of the early XT and AT ROM BIOS's.  Where these limitations are
  373. known, they are mentioned in this document.
  374.  
  375. GET Version 2.7 is distributed as GET27.EXE so as to not inadvertently
  376. overwrite previous versions.  Rename GET27.EXE to GET.EXE when you are ready
  377. to replace older versions.   If you have been using an older version of GET,
  378. read the file GET27NEW.DOC to find out what has been changed, and what has
  379. been added.
  380.  
  381. ACKNOWLEDGMENTS
  382.  
  383.   My thanks to members of MBUG-PC, The Monterey Bay Users' Group - Personal
  384. Computer, for their support.  Many members have used preliminary versions
  385. and offered their comments and suggestions.  I am particularly grateful to
  386. the beta testers who held my feet to the fire to ensure that this would be a
  387. reliable and useful product. I am also grateful to the Bantam Computer Books
  388. for including GET in the Revised Second Edition of "DOS Power Tools," and to
  389. the authors Nick Anis, Craig Menefee, and Ronny Richardson for including GET
  390. in their books on batch files.
  391.  
  392.  
  393.  
  394.  
  395. Page 2                          INTRODUCTION                         GET 2.7
  396.                                       
  397.  
  398. ABOUT THE AUTHOR
  399.  
  400. Bob Stephan has been using and programming computers for over 30 years,
  401. mostly for other companies and for his own use and enjoyment.  Shareware is
  402. his first independent commercial venture.  He has been a mainstay in his
  403. local computer users group for over 12 years and is a past president as well
  404. as an author of articles for the newsletter, a leader of special interest
  405. groups, and a provider of help to members on a variety of topics.
  406.  
  407. LIMITED WARRANTY (and other legalities)
  408.  
  409. Bob Stephan warrants the physical diskette and physical documentation
  410. provided with the registered version to be free of defects in materials and
  411. workmanship for a period of sixty days from the purchase date.  The entire
  412. and exclusive liability and remedy for breach of this Limited Warranty shall
  413. be limited to replacement of the defective diskette or documentation and
  414. shall not include or extend to any claim for or right to recover any other
  415. damages, including but not limited to loss of profit, data, or use of the
  416. software, or special, incidental, or consequential damages or other similar
  417. claims.  In no event will any liability for damages ever exceed the
  418. registration fee actually paid for the license to use the software,
  419. regardless of any form of the claim.  Bob Stephan specifically disclaims all
  420. other warranties, express or implied, including but not limited to, any
  421. implied warranty of merchantability or fitness for a particular purpose.
  422.  
  423. However, I claim that this software will perform substantially as detailed
  424. in this documentation when used on a machine with compatible software (DOS)
  425. and compatible firmware (ROM BIOS).  If it does not work as documented when
  426. used in conformance with this documentation, I will either fix it if it is
  427. broken or refund your registration fee.  If you are not satisfied, return
  428. the original registered disk and documentation within 30 days for a full
  429. refund of the registration fee paid.
  430.  
  431. COPYRIGHT DISPLAY
  432.  
  433. The shareware version of GET will display the copyright notice the first
  434. time it is invoked and periodically after that as it is used.  GET checks
  435. the Environment block to determine whether it has been run prior to the
  436. current call. The g$$= variable (notice the lower case g) is created by GET
  437. to keep track of the number of times GET has been called.
  438.  
  439. The registered runtime version does not display the copyright notice unless
  440. it is called with no valid arguments.  The runtime version for registered
  441. users is under 6K in size.  See additional information later in this
  442. document about the runtime version.
  443.  
  444.  
  445.  
  446.  
  447. GET 2.7                          HELP SCREEN                          Page 3
  448.  
  449. HELP SCREENS
  450.  
  451. If you enter GET alone, or with an invalid argument such as a question mark,
  452. it will display a summary of all GET commands.  See SYNTAX EXPLANATIONS next
  453. for definitions of the notation used in the Help Screen.
  454.  
  455. The help screens are displayed in three pages with a pause after each. You
  456. may exit at any pause by pressing {Esc}.  If no key is pressed it will time
  457. out in 15 seconds and go to the next screen.  Press Esc to exit at this
  458. point, or any key except space, CR, PgUp, or Esc to cancel the timeout. PgUp
  459. can be used to return to the first screen and start over.  If you cancel the
  460. timeout with any key except space, CR, Esc or PgUp, you can later enter any
  461. of those keys to restart the display or perform the desired action.
  462.  
  463. You can make a file copy of this Help Screen by using DOS redirection.
  464. Enter the command GET >GET.HLP.  Each time you see the --More-- prompt,
  465. press Enter again.  This Help Screen will be in the file GET.HLP.  When you
  466. are BATch programming, put the help file in one of your editor's windows
  467. where you can use it for quick reference.  For convenience a preformated
  468. copy of GET.HLP is included in the program package.
  469.  
  470. The next page contains a printout of the complete help screen display as it
  471. was captured from the executable file.
  472.  
  473.  
  474.  
  475.  
  476. Page 4                          HELP SCREEN                          GET 2.7
  477.  
  478. ╔══════════════════════════════════════════════════════════════════════════════╗
  479. ║GET Version 2.7  - Bob Stephan's BATch Enhancer -  Copyright 1995 Bob Stephan ║
  480. ║  Syntax: GET command argument(s) /switches        More Instructions: GET.DOC ║
  481. ║Purpose          Command Argument(s) Switches Environment ErrorLevel Extended ║
  482. ║---------        ------- ----------- ---[/]-- --(GET=)--- --(Exit)-- --[E]--- ║
  483. ║          --------- String Handling and Screen I/O Commands --------          ║
  484. ║Echo             EC   "prompt"            ANS  --         --          --      ║
  485. ║Get character    C[E]["prompt"][chars]    All  ASCII Char ASCII code No Echo  ║
  486. ║aNswer yes or no N[E]["prompt"][seconds]  All  ASCII Char ASCII code No Echo  ║
  487. ║Get string       S[E]["prompt"][pattern]  All  String     Length     Echo .   ║
  488. ║Put string (Zap) Z   ["string/&var"][skip]AWX  String     Length     --       ║
  489. ║Standard Input   ZE  ["prompt"] [skip]    AWX  String     Length     --       ║
  490. ║In String        #[E] "string" ['arg']    WX   Position in string    Extract  ║
  491. ║Moving Text      T[E] "filespec" [chars]  EX   ASCII Char ASCII code No Echo  ║
  492. ║Key waiting      I[E]["prompt"]           AEX  --Character Waiting-- Get Char ║
  493. ║Keyboard bUffer  U[E]["chars"][num][/Wnum]W    [E]Locks   Length     Caps/Num ║
  494. ║             For UE: 16=Scroll Lock, 32=Num Lock, 64=Caps Lock                ║
  495. ║'Rithmetic       R ["+-*/!=&#^~"] num [/Wnum] AW Result   Result              ║
  496. ║Blank Screen     B[E] [New attribute]     AWX  --Old attribute--     HexAttr  ║
  497. ║Video mode/bordr V[E] [New mode/color]         --Old mode/color--    Border   ║
  498. ║Date and Time    H[E] ["prompt"] code    ACWXS Value      Value               ║
  499. ║ Code:1=DoW 2=DoM 4=Mon 8=Yr 16=Hr 32=Min 64=Sec 128=odd/even 256=00ths 512=yy║
  500. ║          --------- Disk and File Commands --------                           ║
  501. ║File size        F[E] filespec[/Wdiv/X/A] AEWX Bytes/Hex  Kilobytes  Kb/10    ║
  502. ║File date        F[E] filespec /E/Wcode   ACES Value      Value               ║
  503. ║  /E required, /W codes: 2, 4, 8, 16, 32, 64, 512 as for GET H[E]             ║
  504. ║Full Path        FP   filespec                 Fullpath   Length     --       ║
  505. ║Disk free space  K[E] [drive] [/Wdiv]     AWX  Kilobytes  Kb/10      Kb/100   ║
  506. ║Disk capacity    Q[E] [drive] [/Wdiv]     AWX  Kilobytes  Kb/10      Kb/100   ║
  507. ║Volume label     L[E] ["label"][drive]    X    Label      1=yes,0=no Match    ║
  508. ║EXEC      X[E] "d:\path\program.ext" 'args'    Exit[Path] Exit[Drive] Path    ║
  509. ║Current dir      Y    [drive]                  Directory  Level:Root=0        ║
  510. ║Current drive    YE          (boot drive /X)   Drive      Drive:A=0           ║
  511. ║          --------- Memory and System Commands --------                       ║
  512. ║Environment left E[E]         (full size /X)   Bytes      Bytes      Bytes/10 ║
  513. ║Memory free      M[E]                          Kilobytes  Kilobytes  Kb/10    ║
  514. ║Break Flag       BR [New flag 1=on, 0=off]         Old flag           --      ║
  515. ║Printer(PRN)     P[E] ["prompt"] [test]   X    1=yes,0=no 1=yes,0=no Init     ║
  516. ║DOS Version      D[E]                          Major Vers MajorMinor MinorEnv ║
  517. ║DESQview Version DV                            Major Vers MajorMinor  --      ║
  518. ║4DOS Version     4                             Major Vers MajorMinor  --      ║
  519. ║Windows          4E                            1=yes,0=no 1=yes,0=no  --      ║
  520. ║Coprocessor/CPU  7[E]                          1=yes,0=no 1=yes,0=no CPU Type ║
  521. ║ANSI.SYS/Model   A[E]                          1=yes,0=no 1=yes,0=no PC Model ║
  522. ║Warm/Cold Boot   W[E] ["prompt"][arg]     All  If arg:1=warm, 0=cold ColdBoot ║
  523. ║ Surrogates: }=Carriage Return, ~=Escape, Alt-255=Space/Blank.                ║
  524. ║ GLOBAL SWITCHES: (apply to most commands if appropriate)                     ║
  525. ║  /H Hex output, /M Master Env, /R Return Code in Environment, /U /L case     ║
  526. ║  /B flush key Buffer, /TL/TR/T Trim Left/Right/Both, /V[&]var=, /V- No var   ║
  527. ║ LOCAL SWITCHES: (action depends on the command)                              ║
  528. ║  /A[num] Attribute ["prompt"], All bytes [F], ASCII [R] /N No CR             ║
  529. ║  /K 10 second timeout Kountdown, /S[n] Sound control/Date format             ║
  530. ║  /C suppress Ctrl-Break during input [C,S,N], Compressed date [H,F/E]        ║
  531. ║  /E /X EXtended keys/EXtra feature, /W[num] Wait or numerical value          ║
  532. ║ See GET.DOC for additional features and BATch programming instructions.      ║
  533. ║ GET is a shareware product. Registration is required for continued use.      ║
  534. ╚══════════════════════════════════════════════════════════════════════════════╝
  535.  
  536.  
  537.  
  538.  
  539. GET 2.7                      SYNTAX EXPLANATIONS                      Page 5
  540.  
  541. SYNTAX EXPLANATIONS (Refer to the HELP SCREEN)
  542.   
  543.   Command: Commands are one or two character combinations as shown on the
  544.     HELP SCREEN.  Single character commands can [optionally] be immediately
  545.     followed by E with no spaces between.  The E indicates the Extended
  546.     function in the last column on the HELP SCREEN.  There must be only one
  547.     space between the word GET and the command character.
  548.   
  549.   Argument(s):  Arguments are zero, one, or two character strings as
  550.     appropriate to the command.  A "string" is a sequence of consecutive
  551.     ASCII characters delimited by double quotes or, if not in quotes, by the
  552.     space character.  In some cases the first, or only, argument must be
  553.     enclosed in double quotes as shown on the HELP SCREEN.  Arguments that
  554.     are not shown in quotes on the HELP SCREEN must not be put in quotes.
  555.     Each character string can consist of zero or more ASCII characters.  The
  556.     blank or space character (ASCII 32) delimits the character strings that
  557.     are not in quotes.  The space character can only be a member of one of
  558.     the strings that is enclosed in double quotes.  (In this document, both
  559.     "blank" and "space" are used as synonyms for the ASCII-32 character.)
  560.     
  561.     [] brackets indicate optional portions of commands and/or arguments. The
  562.       command may work differently depending on whether these portions are
  563.       included or not.  The brackets themselves must not be included!
  564.     
  565.     "  Where double quotes ("'s) are shown, they must be included if the
  566.       corresponding prompt, string, or filespec argument is used.  A
  567.       "prompt" is a special case of a string that is displayed to prompt the
  568.       user for input from the keyboard.
  569.     
  570.     filespecs consist of a filename and extension as appropriate to the DOS
  571.       file naming conventions.  They may include drive and path but no
  572.       wildcards in the general form of d:\path\filename.ext.
  573.     
  574.     chars refers to an ASCII character string which can include any of the
  575.       ASCII characters from decimal 33 to decimal 255 inclusive, but some of
  576.       these characters have special significance (see the section on
  577.       Surrogates below.)
  578.     
  579.       When a character argument (the arg not in double quotes) is called
  580.       for, it can optionally be enclosed in single quotes ("'"s commonly
  581.       used as apostrophes). To include a single quote in the argument, use
  582.       two apostrophes next to each other.  There must always be an even
  583.       number of quote symbols. An argument consisting of just two single
  584.       quotes ('' by itself) is the same as no argument at all.  To specify
  585.       exactly one quote and nothing else use ''''.  Quoting permits
  586.       including a space in the argument for GET C, for example.  Since you
  587.       cannot test for a space with IF, the space character will be reported
  588.       as ASCII 255 unless the /L switch is used. The single quote is usually
  589.       on the same key with the double quote character, and should not be
  590.       confused with the grave accent or "back quote" character which is
  591.       often on the same key as the tilde.
  592.     
  593.     num, div and other numerical arguments must be entered as ASCII decimal
  594.       digit characters representing an integer no larger than 65,535 with no
  595.       commas or decimal points.
  596.     
  597.     $num The $-sign prefex indicates that num is in Hexadecimal if a number
  598.  
  599.  
  600.  
  601.  
  602. Page 6                      SYNTAX EXPLANATIONS                      GET 2.7
  603.  
  604.       is expected.  This is especially useful for GET R and GET B, and can
  605.       be used any place a numerical arg or parameter is expected.
  606.     
  607.     #a The #-sign prefix to an ASCII character means use this character as a
  608.       number.  Thus you can perform arithmetic using the numerical value of
  609.       ASCII characters, or simply use it to report the ASCII number for a
  610.       character.  The # character, like the $ character for hex, can be used
  611.       wherever numerical input is expected; however, with the # character
  612.       only one character immediately following it is converted to the ASCII
  613.       value of that character.  These conversions will be most useful with
  614.       the GET R arithmetic functions.
  615.   
  616.   Environment: this column indicates what will be found in the Environment
  617.     string GET= or the one you name with the /V switch.  This string can be
  618.     accessed from a BATch file with the %GET% notation. It is best to
  619.     enclose %GET% in double quote characters in case it is empty.  For
  620.     example:
  621.        IF "%GET%"=="" 
  622.     will check for an empty GET variable.  The variable name can be changed
  623.     with the /V switch described below.  If you need more information on
  624.     testing Environment variables, see the section on Environment and Shells
  625.     later in this document.
  626.   
  627.   ErrorLevel: this column indicates what value will be placed in the DOS
  628.     ErrorLevel where it can be accessed in BATch files with the "IF
  629.     ErrorLevel" subcommand.  Always check for ErrorLevel from highest to
  630.     lowest values of interest. ErrorLevel is also referred to as Exit Code
  631.     or Return Code.  If you need more information on testing the ErrorLevel,
  632.     see the next section on ERRORLEVEL.
  633.   
  634.   Extended: this column indicates the action taken if the optional E for
  635.     [E]xtended command is included.  The E must be immediately adjacent to
  636.     the command, and do not include the brackets! In most cases E applies to
  637.     either the result in the Environment or the result in the ErrorLevel,
  638.     but not to both.  In a few cases the E invokes a separate but loosely
  639.     related function.
  640.   
  641.   Surrogates:  Some characters are awkward or impossible to handle directly
  642.     in BATch files.  For example, BATch files generally use the carriage
  643.     return <CR> and space characters as delimiters instead of as ASCII
  644.     characters that can be manipulated.  Some special symbols have been
  645.     designated to facilitate the handling of these characters.  These
  646.     substitutions may have different meanings depending on the command being
  647.     used, so read the description of the command.  The special characters
  648.     are:
  649.          Carriage Return: } is used for CR
  650.          Escape:          ~ {tilde} is used for Esc
  651.          Blank:           {Alt-255} is used for Space (Blank).
  652.   
  653.     The Alt-255 character can be entered in most text editors by holding
  654.     down the Alt key while spelling out the digits for the character on the
  655.     number pad of the keyboard, but check your text editor for this
  656.     capability.
  657.   
  658.     It is often convenient to ask the user to press the space bar for GET C.
  659.     The blank (or space) surrogate, Alt-255, makes it possible to check for
  660.     a space.  In most versions of DOS the subcommand IF "%GET%"==" ", or any
  661.  
  662.  
  663.  
  664.  
  665. GET 2.7                      SYNTAX EXPLANATIONS                      Page 7
  666.  
  667.     comparison of strings which include spaces, does not work properly since
  668.     DOS uses the space as a delimiter.  By using Alt-255 as a surrogate for
  669.     the space character, WYSIWYG is maintained, and the character can be
  670.     manipulated like any alphabetic character.  4DOS, however, treats
  671.     strings in double quotes properly.
  672.   
  673.   Switches are special modifiers to GET commands.  A switch is indicated by
  674.     the forward slash character, "/", immediately followed by the
  675.     appropriate letter or character.  See SWITCHES, page 11.
  676.   
  677.   Kilobytes (Kb) refers to the number 1024 which is 2^10 as commonly used in
  678.     measuring digital computer memory and disk space.  Some of GET's results
  679.     (especially disk space) may differ from other measures that use kilo to
  680.     refer to the number 1000.  Similarly, a Megabyte (Mb) is taken to mean
  681.     1024Kb. Definitions that are sometimes used elsewhere are 1000Kb or
  682.     1,000,000 bytes.
  683.   
  684.   ENTERING COMMANDS
  685.   
  686.   GET is used in DOS BATch files. It has been tested with various versions
  687.     of MS-DOS, PC-DOS, and 4DOS.  When you want to use GET in a BATch file
  688.     use the following simple procedure:
  689.   
  690.   1. Enter the word GET as the first entry on a line, followed by a single
  691.     space.
  692.   
  693.   2. Tell GET what it is that you want it to get for you.  Do this by
  694.     selecting and entering a one or two letter command from the Command
  695.     column on the HELP SCREEN.  All of the commands are described in this
  696.     document and the syntax notation of the Help Screen is explained in the
  697.     SYNTAX section above.
  698.   
  699.   3. If there are arguments, enter a space and then the arguments that you
  700.     need or want to run the command.
  701.   
  702.   4. If you want to use any of the /switches, enter them on the same line
  703.     after all argument(s).
  704.   
  705.   5. On the next line of the BATch file, check the return from GET in the
  706.     ErrorLevel and/or the GET= variable in the Environment.  The Environment
  707.     variable can be accessed as %GET% or by the name you give it with the /V
  708.     switch described below.
  709.   
  710.   For example, to get a yes or no answer you might enter the lines:
  711.   
  712.        :Ask
  713.        GET N "Answer yes or no: "
  714.        IF "%GET%"=="N" goto NO
  715.        IF "%GET%"=="Y" goto YES
  716.        Rem The next line checks to see if the user pressed Escape
  717.        if ErrorLevel 126 goto END
  718.        ECHO You must enter Y or N, or press Esc to exit.
  719.        goto ASK
  720.        :NO
  721.        Rem [Do what you need to do if the user enters N]
  722.        goto END
  723.        :YES
  724.  
  725.  
  726.  
  727.  
  728. Page 8                       ENTERING COMMANDS                       GET 2.7
  729.  
  730.        Rem [Do what you need to do if the user enters Y]
  731.        :END The next line clears GET out of the Environment.
  732.        set GET=
  733.   
  734.   DEBUGGING
  735.   
  736.   GET includes a debugging feature to show you what it is doing and help you
  737.     determine the cause of any problems you might be encountering in your
  738.     BATch programming.  To use the debugging feature, issue the SET GET?=ON
  739.     command at the DOS prompt.  This tells GET to report to the screen what
  740.     information it is putting into the Environment and in the ErrorLevel.
  741.     This feature is supported in both the shareware module and in the
  742.     registered RUNTIME module.
  743.   
  744.   SEE HOW IT RUNS
  745.   
  746.   The best way to find out how GET works is to just try it.  You can try it
  747.     from the command line by using the special built-in reporting feature.
  748.     To see what GET is putting in the ErrorLevel and the Environment, issue
  749.     the DOS command SET GET?=ON.  This will tell GET to report the results
  750.     to the screen in addition to placing them in the ErrorLevel and the
  751.     Environment.  Then run the GET commands that you want to check out, or
  752.     run your BATch file to see what GET reports.
  753.   
  754.   You can also try GET from the command line if you use SET (by itself) to
  755.     check what has been placed in the Environment, but to find out what is
  756.     in the ErrorLevel, you must use a BATch file unless you SET GET?=ON.  If
  757.     you are not familiar with the DOS Environment, see the discussion of
  758.     Environment and Shells elsewhere in this documentation.
  759.  
  760.  
  761.  
  762.  
  763. GET 2.7                        The Error Level                        Page 9
  764.  
  765. ERRORLEVEL
  766.  
  767. If you are not familiar with testing for the ErrorLevel in BATch files, read
  768.   this section.  If the ErrorLevel holds no mysteries for you, then skip to
  769.   the next section.  To test a program to determine what ErrorLevel(s) it
  770.   returns, use RUN.EXE included with GET.  See RUN.DOC for details.
  771.  
  772. Most modern programs that run under DOS issue a numeric status code which is
  773.   passed back to DOS when they terminate.  This is variously referred to as
  774.   a "return code", "exit code", "status code", "error code", "Error Level",
  775.   etc.. An "ErrorLevel" is simply that code, whatever it may be called.  In
  776.   many programs an ErrorLevel of 0 means a normal, successful completion,
  777.   and a non-zero return code indicates a problem of some sort.  GET uses the
  778.   ErrorLevel for different purposes to pass information back to the BATch
  779.   file in such a way that the BATch file can make use of it with the IF
  780.   ERRORLEVEL subcommand.
  781.  
  782. IF ERRORLEVEL is one of the cases of the IF statement.  It tests the return
  783.   code from the program for some condition that you specify.  The various IF
  784.   tests always result in a true/false result - either the test is true or it
  785.   is false.  If it is true, the statement following the IF test on the same
  786.   line is executed, otherwise it is ignored.  The IF ERRORLEVEL test is
  787.   always a "greater than or equal" test, or in BASIC parlance >=.  So when
  788.   you enter IF ERRORLEVEL 5 DO SOMETHING, it means "if the return code from
  789.   the previous program is greater than or equal to 5" the BATch file is to
  790.   do something, otherwise it will ignore the rest of the line starting with
  791.   IF.
  792.  
  793. To test specifically for an ErrorLevel of 0 you use the NOT parameter for
  794.   the IF subcommand.  So when you enter IF NOT ERRORLEVEL 1 DO SOMETHING
  795.   ELSE, it means "if the return code is not greater than or equal to 1 do
  796.   something else."  Since return codes can only be integers 0 through 255, a
  797.   return code that is not >= 1, can only be 0, hence the test for
  798.   ErrorLevel=0.
  799.  
  800. ERRORLEVEL tests can be "and"ed to test for a specific return code.  If you
  801.   enter IF ERRORLEVEL 5 IF NOT ERRORLEVEL 6 DO STILL ANOTHER THING, it means
  802.   "if the return code is greater than or equal to 5 but not greater than or
  803.   equal to 6 do still another thing."  The only integer that satisfies those
  804.   conditions is 5 itself.
  805.  
  806. Not all programs return error levels.  DOS itself is the worst offender.  No
  807.   internal commands that I know of return codes, and not all the external
  808.   commands are so thoughtful.  Later versions of DOS are getting better
  809.   about returning and documenting such codes, but unless it is documented
  810.   that a code is returned and what it signifies, there is no way to assume
  811.   that one is available.  To find out what a return code means you must read
  812.   the documentation for the program or command.
  813.  
  814. If there is a possibility of several return codes, the IF ERRORLEVEL tests
  815.   must be used in descending order because of the >= meaning.  For example,
  816.   the MS DOS 5.0 FORMAT command is documented to have the following "exit
  817.   codes."
  818.   
  819.     0  The format operation was successful.
  820.  
  821.     3  The user pressed Ctrl-C to stop the process.
  822.  
  823.  
  824.  
  825.  
  826. Page 10                        The Error Level                       GET 2.7
  827.  
  828.  
  829.     4  A fatal error occurred (any error other than 0, 3, or 5).
  830.  
  831.     5  The user pressed N in response to the prompt "Proceed with
  832.   Format(Y/N)?" to stop the process
  833.  
  834.   You can set up a BATch file to automate the FORMATTING process, then check
  835.   to see if it was successful.  A portion of your BATch file might look like
  836.   this:
  837.  
  838. :AGAIN
  839. FORMAT %1 %2 %3
  840. if ErrorLevel 5 goto DONE
  841. if ErrorLevel 4 goto ERROR
  842. if ErrorLevel 3 goto ASK
  843. Rem If it wasn't one of the above, it has to be 0,
  844. Rem so go back to see if you want to do it again.
  845. goto AGAIN
  846. :ERROR Come here if a fatal error occurred - code=4.
  847. ECHO The FORMAT command failed!
  848. :ASK Come here if the ErrorLevel was 3 - user pressed Ctrl-C
  849. GET N "Do you want to try another disk?"
  850. if "%GET%"=="Y" goto AGAIN
  851. :DONE
  852. Echo The FORMAT operation has been completed!
  853. Echo Have a good day.
  854.  
  855.  
  856.  
  857.  
  858. GET 2.7                           SWITCHES                           Page 11
  859.  
  860. SWITCHES AND SUCH
  861.  
  862. Switches are special modifiers to GET commands.  A switch is indicated by
  863.   the forward slash character, "/", immediately followed by the appropriate
  864.   letter or character.  More than one switch may be used with a command, and
  865.   all switches must come after any other arguments.  Switches that are not
  866.   applicable to a command will be ignored and not cause any harm if
  867.   inadvertently included.  Where the switches duplicate other features, the
  868.   switch is the preferred method.  The switches that have been implemented
  869.   in Release 2.7 and subsequent are /A, /B, /C, /E, /H, /K, /L, /M, /N, /R,
  870.   /S, /T, /TR, /TL, /U, /V, and /W.
  871.  
  872. GLOBAL SWITCHES
  873.  
  874.   The switches /B, /H, /L, /M, /R, /T, /TR, /TL, /U, and /V have global
  875.   meanings that remain the same for all commands for which the meaning of
  876.   the switch makes sense.  Global switches are omitted in the list of
  877.   switches for a command to simplify the listing, but they can be used
  878.   wherever applicable.  Most of these switches directly affect the output
  879.   that will be put into the ErrorLevel and/or the Environment.
  880.  
  881. /B flush keyboard Buffer.  Useful to flush any type-ahead keystrokes when
  882.   asking for user input.
  883.  
  884. /H provides a generalized Hexadecimal output capability.  Whenever numerical
  885.   output is expected in the Environment, /H will convert the output to
  886.   Hexadecimal.  For GET F, /X will still report the full filesize in hex
  887.   even if the errorlevel is in kilobytes (/A not being used), while /H will
  888.   report kilobytes in hex unless /A is being used.  See GET F for details.
  889.  
  890. /L specifies that the string that is written to the Environment is to be
  891.   forced into lower case.  Any ASCII-255 characters will be "lowercased" to
  892.   the ASCII space character, but remember that strings with spaces in them
  893.   will not test properly with the DOS BATch IF subcommand.  Also: see /U for
  894.   Uppercase.
  895.    Example: GET SE "Enter your password: "  /C /L
  896.  
  897. /M tells GET to try to put the string in the master environment instead of
  898.   the child environment.  If the BATch file is being run from a secondary
  899.   shell, GET will bypass the environment of the secondary command processor
  900.   and look for the master environment.  Without /M GET will put the result
  901.   into the first command processor environment that it finds.  /M can be
  902.   used with any GET command.  If you need more information about the
  903.   different environment areas see the section on ENVIRONMENT AND SHELLS.
  904.     Example: GET Z "Put this string in the master environment" /M
  905.   NOTE: There is a slightly different meaning for the /M switch with GET Z
  906.   if the "&var" feature is used.  See the description of GET Z for more
  907.   information.
  908.  
  909. Caution: Finding the master environment is not a documented feature of DOS,
  910.   and there is no guarantee that /M will work under all conditions.  For
  911.   example, don't expect it to work if the command processor is running in a
  912.   DESQview window or under Windows, and it may cause the system to hang.  If
  913.   you need this capability, be sure to test it under all possible conditions
  914.   before relying on it.
  915.  
  916. /R will force the Return Code into the Environment for any GET command
  917.  
  918.  
  919.  
  920.  
  921. Page 12                           SWITCHES                           GET 2.7
  922.  
  923.   instead of the normal Environment result.  See example under GET F.
  924.  
  925. /TR and /TL trim blanks from the string that is written to the environment.
  926.   Trim is useful with S, SE, Z, ZE, and HE.  /TR or /T+ will trim blanks
  927.   from the right or trailing end of the string, while /TL or /T- will trim
  928.   blanks from the left or leading end of the string.  Both switches may be
  929.   used in the same command if desired, or the /T (Trim) switch by itself
  930.   (not /TR or /TL) will trim both left and right.  You can also use /TB to
  931.   trim both.  Trim will also trim Alt-255 characters (as upper case spaces).
  932.  
  933. /U specifies that the string that is written to the Environment is to be
  934.   forced into upper case (Caps).  Any spaces will be "uppercased" to ASCII
  935.   255 so that the string can be tested with the BATch IF subcommand.  /U is
  936.   not necessary with the C, N, I, or T commands.  Also: see /L for
  937.   Lowercase.
  938.    Example: GET SE "Enter your password: "  /C /U
  939.  
  940. /Vvar= lets you specify a name for the Environment variable to be used in
  941.   place of "GET".  This can eliminate some BATch file lines that would be
  942.   used to save the GET variable under another name with the SET command.
  943.   The name must be contiguous with the V in /V and should be terminated with
  944.   the = sign.  Although the '=' sign is optional, the name must be
  945.   terminated in some way, and the '=' sign is the recommended method.
  946.   However, any one of the following characters will serve as the terminating
  947.   delimiter for the name: =, space, /, or carriage return (indicating the
  948.   end of the command line or BATch file line).  Lowercase letters will be
  949.   coerced to uppercase before placing the name in the Environment.  The
  950.   following example will establish an Environment variable that will show up
  951.   as DEMO= instead of the default name GET=.
  952.     Example (old method): GET C "Enter the drive letter: " ABCD
  953.                           set DEMO=%GET%
  954.     Example (new method): GET C "Enter the drive letter: " ABCD /vdemo=
  955.  
  956.  /V&var  Create mixed case Environment variable names.
  957.  
  958.   When you use the /V switch to create a variable name, if the first
  959.   character is an ampersand (&) the name will not be converted to uppercase.
  960.   If you have any lowercase characters in the name, they will remain
  961.   lowercase, thus you can use all lowercase or even mixed case.  With the
  962.   GET Z "&var" feature, you will be able to read these variables, but they
  963.   will not be available to most other DOS programs.  Whether creating or
  964.   reading a variable with &var, the & is not taken to be part of the name;
  965.   however, any additional embedded &'s will be used as part of the name.
  966.  
  967. CAUTION:  If you modify BATch files to take advantage of the convenience of
  968.   the /V switch, be sure you adjust all references to the %GET% variable in
  969.   subsequent statements to reflect the new variable name.
  970.  
  971. /V- completely suppresses creating the Environment variable under any name.
  972.   No changes to the Environment will be made.  This is useful when the
  973.   result is of no interest, or when all the information required can be
  974.   obtained from the ErrorLevel.  This may be useful at times when there is
  975.   insufficient free space in the Environment, or when there is reluctance to
  976.   create an Environment variable which might overwrite one that is already
  977.   there.
  978.  
  979. NOTE: A side effect of /V- is that SET GET?=ON will have no effect.  Since
  980.  
  981.  
  982.  
  983.  
  984. GET 2.7                           SWITCHES                           Page 13
  985.  
  986.   the search of the Environment is being completely bypassed, GET cannot
  987.   check for the GET? variable.
  988.  
  989. LOCAL SWITCHES
  990.  
  991.   The remaining switches may have different meanings and uses which depend
  992.   on the command being used, and as defined in the description of the
  993.   command.  They are described here as they pertain to commands in the next
  994.   section, String Handling and Screen I/O, as they affect the prompts and
  995.   other aspects of obtaining input from the user.  In subsequent sections
  996.   some of these switches will have different meanings, so it is necessary to
  997.   carefully read the description of the command to determine the correct
  998.   usage of the switches.
  999.  
  1000. /A lets you control the screen attribute of prompts.  The prompts can be
  1001.   displayed in reverse video, or any of 254 color combinations that are
  1002.   available on color monitors.  /A by itself causes the prompt to be
  1003.   displayed in reverse video.  /Annn, where nnn is a number between 1 and
  1004.   254 specifies the attribute to be used for the prompt.  The following
  1005.   table explains how to construct the attribute.  It is not necessary to
  1006.   have ANSI.SYS or any of its clones loaded to display prompts with
  1007.   attributes.
  1008.  
  1009.         The color codes are:
  1010.            0 Black         2 Green      4 Red          6 Brown
  1011.            1 Blue          3 Cyan       5 Magenta      7 White
  1012.  
  1013.         For the foreground color for the characters:
  1014.            1. Select the color number from the above table.
  1015.            2. For high intensity (bright or light), add 8.
  1016.            3. For Blinking, add 128.
  1017.         Example:
  1018.            Blinking, high-intensity magenta is 5+8+128=141
  1019.  
  1020.         For the background color:
  1021.            1. Select the color number from the above table.
  1022.            2. Multiply it by 16.
  1023.            3. Add it to the foreground color.
  1024.   Example:
  1025.   Blinking, high-intensity magenta on white is 141+(7*16)=253
  1026.   GET C "This is in blinking, high-intensity, magenta on white " /A253
  1027.  
  1028.   With some systems there can be a minor problem if the user presses break
  1029.   when the prompt is displayed on the bottom line of the screen if using /A
  1030.   to color the prompt. In some cases the prompt color gets taken by DOS as
  1031.   the new color to use for scrolling the screen.
  1032.  
  1033.   If the /A switch is not included, the prompt will be displayed in such a
  1034.   manner that ANSI sequences can be used for screen control.  The "prompt"
  1035.   will always be sent to the screen even if standard output is redirected
  1036.   with DOS redirection (>).  Without /A the prompt can be as long as will
  1037.   fit on the DOS command or BATch line which is limited to 128 characters
  1038.   total.  With /A, the prompt is limited to 79 characters.  See  also the
  1039.   GET EC command for a specific method of echoing strings to the screen.
  1040.  
  1041.   Note that commands which do not use a "prompt" may use /A for other
  1042.   purposes.  See the individual command descriptions for additional
  1043.  
  1044.  
  1045.  
  1046.  
  1047. Page 14                           SWITCHES                           GET 2.7
  1048.  
  1049.   information.
  1050.  
  1051. /C tells GET to handle Ctrl-C and Ctrl-Break instead of letting DOS do it.
  1052.   See the GET USER INPUT section for additional details.
  1053.    Example: GET SE "Enter your password: " /C.
  1054.  
  1055. /E specifies that keystrokes will be read from the Enhanced keyboard when
  1056.   getting user input with the C, N, I, and T commands.  See also /X.
  1057.     Example: GET C "Enter F11 to continue: " Θ /E
  1058.  
  1059.   NOTES: Extended keys are those with no ASCII representation, such as the
  1060.   function and cursor keys.  Enhanced keys are keys on the enhanced keyboard
  1061.   which do not appear on older keyboard layouts, such as F11 and F12.
  1062.   Commands that do not accept keyboard input may use /E for other purposes.
  1063.  
  1064. /K controls the "Kountdown" in commands that are waiting for user input, and
  1065.   may be used for other purposes with commands that do not ask for user
  1066.   input.
  1067.  
  1068. /N is a switch to suppress the carriage return after a prompt.  This works
  1069.   with any command that issues a prompt, including ECho (GET EC).  Use with
  1070.   caution.  If the prompt is on the bottom line of the screen and the /A
  1071.   switch is being used, DOS may pick up the prompt attribute as the new
  1072.   screen attribute as it scrolls. Various video BIOS's may produce different
  1073.   results.
  1074.  
  1075. /S SOUND BYTES. Either /S or /S0 will turn off the beeps for various alerts,
  1076.   such as striking an invalid key, or getting a time-out.  Additional sound
  1077.   control features have been added for use with the /Sn switch.  As before
  1078.   /S or /S0 will turn off error beeps.  /S1 (the default) is normal beeping
  1079.   using the ASCII 7 BEL character.  The n in /Sn can also take on values
  1080.   from 2 through 255 to produce various combinations of sounds.  This is
  1081.   best explained using hexadecimal input as /S$xy where x and y can each be
  1082.   from 0 through F (but together must represent a number greater than 1).
  1083.  
  1084.   Each hex digit (1-F) will produce a tone approximately 1/2 second long.
  1085.   The larger the digit, the lower the tone.  A digit of 0 will produce no
  1086.   tone, thus all combinations except /S$0, /S$00, /S$1, and /S$01 are valid
  1087.   (i.e., /S$2 or /S$02 through /S$FF are valid).  Experiment to find the
  1088.   ones that are pleasing to your ear.
  1089.  
  1090.   The GET EC (ECho) command will take the /Sn switch and unconditionally
  1091.   echo the specified tones with or without a "prompt" specified.  All other
  1092.   commands that can produce beeps do so in response to an error condition or
  1093.   a timeout.
  1094.  
  1095. /W has different meanings for different commands, but it is always used to
  1096.   input a number for use by the command.  When getting user keyboard input,
  1097.   /W is used to specify a number of seconds to wait.  In other commands the
  1098.   number has other meanings and uses.  See the description of the command
  1099.   for further details.  /W (by itself) is defined to be the same as /W0.
  1100.   This has implications for functions such as C, S, N, W, and R.  See GET R
  1101.   below.  When numerical input is used for an argument or with /W, the
  1102.   numbers can be as large as 65535 but may not include commas or decimal
  1103.   points.
  1104.  
  1105.   NOTE: All waiting periods work properly in multitasking environments. The
  1106.  
  1107.  
  1108.  
  1109.  
  1110. GET 2.7                           SWITCHES                           Page 15
  1111.  
  1112.   DOS "idle interrupt" is called to permit multitasking in these
  1113.   environments.
  1114.  
  1115. /X provides eXtra functionality for a command.  It has different meanings
  1116.   depending on the command being used.  When getting keyboard input, /X
  1117.   specifies that extended keys will be accepted. /X is also used to specify
  1118.   hexadecimal output for the GET F (file size) command, and for other
  1119.   purposes with other commands.  See GET F or the specific command for
  1120.   further details.
  1121.  
  1122.   When /X is specified for GET S, if the user presses Escape, the Escape
  1123.   surrogate will be the result, and if the user presses Return {Enter}
  1124.   before pressing any other keys, the CR surrogate will be the result.  A
  1125.   timeout will produce a 0 (zero) result.  If /X is not specified, all three
  1126.   of these user actions will produce a 0 result.
  1127.  
  1128.  
  1129.  
  1130.  
  1131. Page 16                        Get User Input                        GET 2.7
  1132.  
  1133. USING GET COMMANDS
  1134.  
  1135. The description of GET commands is subdivided into the following sections:
  1136.     
  1137.     String Handling and Screen I/O
  1138.     DISK and FILE Information
  1139.     MEMORY and SYSTEM Information
  1140.  
  1141. STRING HANDLING AND SCREEN I/O
  1142.  
  1143. The commands C, N, T, S, I, EC, Z, #, R, B, V, H, and U pertain to obtaining
  1144.   keyboard input from the user, moving and modifying text strings, and
  1145.   getting and setting screen attributes.  These commands take 0, 1, or 2
  1146.   arguments as shown on the HELP SCREEN, and can make use of many of the
  1147.   switches.
  1148.   
  1149.   "prompt"  refers to an arbitrary character string that will be displayed
  1150.     on the screen to coach the user as to what type of input is expected. If
  1151.     a prompt is used, it must be enclosed in double quotes.  Prompts can be
  1152.     displayed in reverse video or in color with the /A switch.
  1153.   
  1154.   NOTE: The "prompt" can be used to issue printer and ANSI.SYS control
  1155.     escape sequences.  It is more convenient to use GET to do this, than to
  1156.     make changes to the DOS PROMPT and have to reset PROMPT, especially if
  1157.     the BATch file is going to be run on various computer systems that may
  1158.     use different prompts.  Do not use /A when you want ANSI.SYS or one of
  1159.     its clones to see the prompt.  If any form of /A is specified, GET uses
  1160.     a different method of displaying the prompt which bypasses ANSI.SYS.
  1161.     Note also, that when /A is used, the maximum length of the prompt is 79
  1162.     characters.  Longer prompts will be truncated to 79 characters.  Without
  1163.     /A the prompt can be longer, limited only by the maximum length of a
  1164.     BATch file line which in most versions of DOS is 128 characters.
  1165.   
  1166.   'chars' are ASCII character strings which may include the space character
  1167.     if enclosed in quotes, and can include surrogates. If any chars are
  1168.     given, user input will be limited to the characters in the character
  1169.     string including those indicated by the surrogates. If no chars are
  1170.     given, any key stroke will be accepted. To indicate that a carriage
  1171.     return, Esc, or space is acceptable, include the appropriate surrogate
  1172.     character.  CR and Esc will return 125 and 126 in the ErrorLevel
  1173.     respectively, and the surrogate character in the Environment.  Space
  1174.     will return Alt-255 if the characters are converted to uppercase.
  1175.     Uppercase is automatic with C, N, I, and T, or when the /U switch is
  1176.     used.  It can be defeated with the /L switch.  Think of ASCII 255 as an
  1177.     upper-case Space for purposes of GET input.
  1178.   
  1179.   pattern is a special case of chars in which certain characters have
  1180.     special meanings.  See the S command for detailed information.  
  1181.   
  1182.   switches as they pertain to this section of the manual.  The following
  1183.     provides additional details for a few of them.  See the previous section
  1184.     for descriptions of the /A, and /N switches.
  1185.   
  1186.   NOTE: Since global switches are generally applicable to all commands, only
  1187.     the local switches are listed for each command.
  1188.   
  1189.   /E uses the BIOS function for the enhanced keyboard.  This permits the
  1190.  
  1191.  
  1192.  
  1193.  
  1194. GET 2.7                        Get User Input                        Page 17
  1195.  
  1196.     recognition of F11 and F12 as well as other enhanced and extended
  1197.     keyboard keys.  /E should not be used unless you are sure that all users
  1198.     of your BATch file will be using enhanced keyboards because it
  1199.     absolutely does not work on machines with older BIOS's that do not
  1200.     recognize the enhanced keyboard interrupt.
  1201.   
  1202.   /X specifies that extended keys will be accepted. /X is used in the same
  1203.     manner as /E, but will not recognize F11, F12 or other Enhanced keys.
  1204.       Example: GET C "Enter F1 to continue: " ƒ /X
  1205.   
  1206.     If extended or enhanced keyboard characters are specified with /X or /E
  1207.     (you don't need both) the scan code plus 100 will be in the ErrorLevel
  1208.     and the corresponding upper ASCII character in the Environment.  A table
  1209.     of keyboard scan codes is included in Appendix A which can be found in
  1210.     the file SCANCODE.DOC.
  1211.   
  1212.     The extended and enhanced scan codes are mapped to the upper ASCII table
  1213.     by adding 100 to the scan code.  For example, the scan code for F1 is
  1214.     59.  If extended keys are allowed, the upper ASCII character 159, "ƒ",
  1215.     will limit extended keystrokes to just the F1 key.  Scan codes of 28
  1216.     through 150 are recognized as the upper ASCII surrogates 128 through
  1217.     250.  A table of scan and ASCII codes is included in the file
  1218.     SCANCODE.DOC.  One method of entering the upper ASCII characters is by
  1219.     using the Alt-NumPad feature of DOS.
  1220.   
  1221.     There are some caveats that go along with this extended key scheme.
  1222.      
  1223.      1. If you want extended and/or enhanced keys to be recognized, you must
  1224.         include the switch for those keys. The upper ASCII characters will
  1225.         not be recognized as surrogates for the extended keys unless the
  1226.         switch is included.
  1227.      
  1228.      2. If you specify any individual keys at all, then you must specify all
  1229.         keys that you want to allow.  The following will not do what appears
  1230.         to be intended:
  1231.             GET C "Press x or any function key: "  x /X
  1232.         In this example, only the X key will be accepted even though the /X
  1233.         switch is included.  A better example is:
  1234.             GET C "Press x or F1: "  xƒ /X
  1235.         or equivalently but not preferred:
  1236.             GET C "Press x or F1: "  xƒ{
  1237.      
  1238.      3. Also note that the mapping of extended keys for GET U is not the
  1239.         same as for GET C.
  1240.   
  1241.   /C (Break): The /C switch will suppress DOS Control-C and Ctrl-Break
  1242.     handling.  For this purpose it applies only to the S, C, and N commands,
  1243.     but may be used for other features with other commands. Ctrl-Break
  1244.     handling works a bit differently according to whether you have specified
  1245.     a waiting time or not.  If no timeout has been specified, Ctrl-Break
  1246.     will just cause a beep.  If a timeout has been specified, and the first
  1247.     keystroke is Ctrl-Break, then GET will simulate a timeout with an
  1248.     ErrorLevel of 0, the same ErrorLevel you would check for to see if there
  1249.     was a timeout.  If any character is entered, the timeout is cancelled,
  1250.     and Ctrl-Break is handled as if there is no timeout.  For single
  1251.     character input, Ctrl-C will return the value and ASCII character 3
  1252.     (Heart) if all characters are allowed (no chars string), or a beep if
  1253.  
  1254.  
  1255.  
  1256.  
  1257. Page 18                        Get User Input                        GET 2.7
  1258.  
  1259.     specific chars are specified.  This provides versatility in break
  1260.     handling, but some experimentation would be a good idea to become
  1261.     familiar with the methods.
  1262.   
  1263.   /W[nnnn] The number nnnn following /W will be used to establish the number
  1264.     of seconds to wait for the first key stroke to be entered.  If timeout
  1265.     takes place with nothing entered, the ErrorLevel will be 0, and there
  1266.     will be no GET variable in the Environment.  If /W is omitted, GET will
  1267.     wait forever.  If a wrong key is pressed the timeout is cancelled.
  1268.       Example: GET C "Answer Yes or No: " YN /W20 
  1269.     will wait 20 seconds for a character to be entered.  If none are entered
  1270.     in that time, GET will exit with 0.  If a wrong character (not Y or N)
  1271.     is entered, GET will wait until a correct character is entered
  1272.     regardless of the time. The default if /W is omitted is interpreted to
  1273.     mean wait forever.
  1274.   
  1275.   /W0 or /W with no number indicates no wait.  The prompt will be displayed,
  1276.     and GET will immediately exit with ErrorLevel 0.  This is useful to
  1277.     "echo" text in reverse video or in color with the /A switch.  If a
  1278.     character is ready in the keyboard buffer due to a type-ahead, GET C, T,
  1279.     and N will read that character.  If it was a valid character for the
  1280.     command, it will be reported as a valid character for the command.
  1281.   
  1282.   /K is a new switch to activate a countdown during the last 10 seconds of
  1283.     waiting time for /Wnum. GET C[E] and GET S[E] with the /Wn and /K
  1284.     switches for a waiting time will count the last 10 seconds as 9, 8, ...,
  1285.     0.  This gives a 10 second warning that the waiting time is about to
  1286.     expire  If an invalid key is pressed during the waiting time, a splat,
  1287.     '*', (asterisk) will be displayed which will remain until a valid key is
  1288.     pressed.
  1289.   
  1290.   /L will convert any uppercase Environment characters to lowercase.  For
  1291.     get C, T, and N, the ErrorLevel will still represent the ASCII code for
  1292.     the uppercase character, and the Echo, if any, will be the uppercase
  1293.     character.
  1294.   
  1295.   /S SOUND bytes.  See description of the /Sn switch above.
  1296.   
  1297.   General: The C, N, I, and S commands read characters using a BIOS call so
  1298.     they bypass Standard Input and most keyboard redefinition methods
  1299.     (macros).  The T and ZE commands use a DOS call so work slightly
  1300.     differently.
  1301.   
  1302.     IMPORTANT: Please remember that the special ASCII characters '<', '>',
  1303.     and '|' are DOS redirection characters and you cannot use them as
  1304.     characters in BATch files.  4DOS also uses '^' and the grave accent
  1305.     (back quote) as special characters so they should not be used unless you
  1306.     know that no users of your BATch file will be running 4DOS or NDOS
  1307.     instead of COMMAND.COM.  Single keystrokes for C, N or T are acted on
  1308.     without pressing Enter. (String input, of course, will require the user
  1309.     to press Enter.)
  1310.   
  1311.     When a character is entered by the user in response to C, N, or T, it is
  1312.     compared with the list of valid chars (if any).  This validation of
  1313.     characters is not case sensitive.  That is, if the user enters a
  1314.     lowercase letter it will be converted to uppercase and the chars will
  1315.     also be converted to uppercase if necessary before any validation
  1316.  
  1317.  
  1318.  
  1319.  
  1320. GET 2.7                        Get User Input                        Page 19
  1321.  
  1322.     comparisons are made.
  1323.   
  1324.     When checking for string matching with the MS DOS BATch IF subcommand,
  1325.     remember that it is case sensitive. Different versions of DOS handle 
  1326.       IF "string1"=="string2" 
  1327.     somewhat differently, and there have been several "bugs" reported in one
  1328.     version or another.  Try to test any such constructs under several DOS
  1329.     versions including DR DOS and 4DOS/NDOS if possible.  In some versions
  1330.     the string cannot contain any spaces.  The test under 4DOS is not case
  1331.     sensitive, and it can contain spaces if the strings are enclosed in
  1332.     double quotation marks.  Only 4DOS does it right.
  1333.   
  1334.   INTERNATIONAL DATES AND TIMES SUPPORTED
  1335.   
  1336.     The date and time functions in GET (H and F) will now report the dates
  1337.     and times in the format specified by the country code that is currently
  1338.     in use.  (See additional information under GET H below.)
  1339.  
  1340.  
  1341.  
  1342.  
  1343. Page 20                          GET Character                         GET C
  1344.  
  1345.   GET C                                                        Get Character
  1346.   
  1347.   Syntax: GET C[E] ["prompt"] ['chars'] [/switches]
  1348.   Input:  "prompt" to be displayed.
  1349.           'chars' to specify the acceptable characters that can be entered.
  1350.   Output: ErrorLevel - ASCII or surrogate scan code.
  1351.           Environment - character entered
  1352.   Switches:
  1353.           /A controls Attribute of prompt
  1354.           /C suppresses Ctrl-Break and Ctrl-C
  1355.           /E enables enhanced and extended keyboard keys
  1356.           /K Kountdown the final 10 seconds
  1357.           /N Suppress carriage return after prompt
  1358.           /S Sound bytes
  1359.           /X enables extended keyboard keys
  1360.           /Wnum Waits num seconds for input
  1361.   
  1362.   C is short for "Character".  GET C obtains a single character from the
  1363.     user and does not wait for a carriage return <CR> to be pressed.  As
  1364.     soon as the user presses a key, GET immediately evaluates the key that
  1365.     was pressed. The keystroke will be echoed to the screen to provide the
  1366.     user with feedback on the key that was pressed. If the keystroke is an
  1367.     alphabetic character (letter) it will be converted to uppercase if
  1368.     necessary, although the echo will be the actual letter typed in by the
  1369.     user.  The storage of the letter in uppercase can be reversed with the
  1370.     /L switch for lowercase.
  1371.   
  1372.   GET CE is a special case in which the character is not echoed to the
  1373.     screen.  This might be useful if the character represents a password or
  1374.     other secret symbol that must be held confidential and hidden from the
  1375.     eyes of casual observers, or if the character entered has no special
  1376.     significance as with the PAUSE command.
  1377.   
  1378.   In its simplest form, GET C, no prompt is issued and any keystroke except
  1379.     extended keys will be accepted.  The BATch file will simply pause until
  1380.     a key is pressed.  However, the user should be given some indication of
  1381.     what is expected, and the prompt provides a convenient means to do so.
  1382.     For example, you can emulate the DOS PAUSE subcommand with the following
  1383.     command.
  1384.   
  1385.   GET C "Press a key when ready . . ."
  1386.   
  1387.   This is more convenient than the PAUSE subcommand because the prompt can
  1388.     be anything you want it to be such as "Press a key when you want to
  1389.     continue . . .".  As with the PAUSE command, it can be preceded in the
  1390.     BATch file with ECHO statements giving more information as to what the
  1391.     pause is for.  It is also more useful with the /A switch to control the
  1392.     attribute, and/or the /W switch to control the pausing time.
  1393.   
  1394.   The optional argument [chars] is a single string of characters that limit
  1395.     the acceptable user input.  Any other character entered will produce a
  1396.     beep, and GET will wait for another character.  In addition to the
  1397.     common alphanumeric keyboard characters, special characters can be
  1398.     indicated as discussed above under Surrogates and Extended Characters.
  1399.     The space character can be included if the string is enclosed in single
  1400.     quotation marks (apostrophes).
  1401.  
  1402.  
  1403.  
  1404.  
  1405. GET C                          GET Character                         Page 21
  1406.  
  1407.   If the /C switch is included, the user will not be able to exit by
  1408.     pressing Ctrl-Break, and Ctrl-C will be treated like any other
  1409.     character; i.e. if any chars are specified, then Ctrl-C will not be
  1410.     allowed because it cannot be specified, but if no chars are specified
  1411.     then Ctrl-C will return ASCII 3.  Ctrl-C is ASCII 3 and will be
  1412.     indicated by the number 3 in the ErrorLevel and the ASCII character for
  1413.     3, the heart, in the Environment. 
  1414.   
  1415.   EXAMPLES:
  1416.   
  1417.   1. To issue a message and wait for a key to be pressed similar to the DOS
  1418.     PAUSE subcommand:
  1419.   
  1420.   ECHO Make sure your printer is turned on.
  1421.   GET C "Press a key when ready . . ."
  1422.   
  1423.   2. To present a simple menu and let the user make a selection.  The /C
  1424.     switch indicates suppression of the Control-Break keystroke.  Neither
  1425.     Control-C nor Control-Break will be accepted.
  1426.   
  1427.   :MENU
  1428.   ECHO A Word Processor
  1429.   ECHO B Spreadsheet
  1430.   ECHO C Database
  1431.   GET C "Select A, B, or C: " ABC /C
  1432.   IF "%GET%"=="A" GOTO WP
  1433.   IF "%GET%"=="B" GOTO SS
  1434.   IF "%GET%"=="C" GOTO DB
  1435.   GOTO MENU
  1436.   :WP
  1437.   Rem Call your word processor here
  1438.   GOTO MENU
  1439.   :SS
  1440.   Rem Call your spread sheet here
  1441.   GOTO MENU
  1442.   :DB
  1443.   Rem Call your database manager here
  1444.   GOTO MENU
  1445.   
  1446.   3. To illustrate the use of surrogates. The empty space between } and ~ is
  1447.     the ASCII 255 character entered with Alt-255, not the regular space
  1448.     character.  The /W20 waits 20 seconds for a response.  /A will cause the
  1449.     prompt to be displayed in reverse video.
  1450.  
  1451.  
  1452.  
  1453.  
  1454. Page 22                          GET Character                         GET C
  1455.  
  1456.   :START
  1457.   GET C "Press <CR>, space bar, or Esc: " } ~ /W20 /A
  1458.   IF ErrorLevel 255 GOTO SPACE
  1459.   IF ErrorLevel 126 GOTO ESCAPE
  1460.   IF ErrorLevel 125 GOTO RETURN
  1461.   GOTO START
  1462.   :SPACE
  1463.   Echo The space bar was pressed.
  1464.   GOTO END
  1465.   :ESCAPE
  1466.   Echo The Escape key was pressed.
  1467.   GOTO END
  1468.   :RETURN
  1469.   Echo The Enter key was pressed.
  1470.   :END
  1471.   
  1472.   4. Same example as 3 using the Environment variable instead of the
  1473.     ErrorLevel.  Note that " " is ASCII 255 in double quotes, not the
  1474.     regular space character.  As above, the /W20 switch will wait for 20
  1475.     seconds then continue, but since none of the valid characters will be in
  1476.     the %GET% variable, the next 3 lines will fall through and the GOTO
  1477.     START line will cause a loop back to :START for another 20 second wait.
  1478.   
  1479.   :START
  1480.   GET C "Press <CR>, space bar, or Esc: " } ~ /W20
  1481.   IF "%GET%"==" " GOTO SPACE
  1482.   IF "%GET%"=="~" GOTO ESCAPE
  1483.   IF "%GET%"=="}" GOTO RETURN
  1484.   GOTO START
  1485.   :SPACE
  1486.   Echo The space bar was pressed.
  1487.   GOTO END
  1488.   :ESCAPE
  1489.   Echo The Escape key was pressed.
  1490.   GOTO END
  1491.   :RETURN
  1492.   Echo The Enter key was pressed.
  1493.   :END
  1494.  
  1495.  
  1496.  
  1497.  
  1498. GET N                        GET yes/no aNswer                       Page 23
  1499.  
  1500.   GET N                                                    Get yes/no aNswer
  1501.   
  1502.   Syntax: GET N[E] ["prompt"] [/switches]
  1503.   Input:  "prompt" to be displayed.
  1504.   Output: ErrorLevel - ASCII or surrogate code.
  1505.           Environment - character
  1506.   Switches:
  1507.           /A controls Attribute of prompt
  1508.           /C suppresses Ctrl-Break and Ctrl-C
  1509.           /K Kountdown the final 10 seconds
  1510.           /N Suppress carriage return after prompt
  1511.           /S Sound bytes
  1512.           /Wnum Waits num seconds for input
  1513.   
  1514.   GET N is a special case of C that will accept only y, n, carriage return,
  1515.     or Esc.  The Ctrl-C suppression and the number of seconds switches to
  1516.     wait may be specified, but no [chars] argument will be recognized. The
  1517.     syntax rules for GET C apply to GET N.  The only purpose for GET N is
  1518.     just to make programming yes/no answers a bit simpler than using GET C
  1519.     and having to always specify the YN and surrogate characters.
  1520.   
  1521.   EXAMPLES:
  1522.   
  1523.   1. The following two statements are functionally identical:
  1524.   
  1525.   GET N "Answer yes or no (y/n): "
  1526.   GET C "Answer yes or no (y/n): " YN}~
  1527.   
  1528.   2. Using ErrorLevel.  89 is the ASCII code for Y, 78 is the ASCII code for
  1529.     N, 125 is the code for the Carriage Return surrogate, and 126 for the
  1530.     Escape surrogate.  This example also illustrates a method of using the
  1531.     Environment for defining variables where the value of GET is redefined
  1532.     according to what the ErrorLevel was from the Yes/No question.  The
  1533.     resulting value of %GET% is used in the message Echoed in the last line.
  1534.   
  1535.   GET N "Answer yes or no (y/n): "
  1536.   IF ErrorLevel 126 GOTO ESCAPE
  1537.   IF ErrorLevel 125 GOTO RETURN
  1538.   IF ErrorLevel 89 GOTO YES
  1539.   IF ErrorLevel 78 GOTO NO
  1540.   SET GET=Break
  1541.   GOTO END
  1542.   :ESCAPE
  1543.   SET GET=Escape
  1544.   GOTO END
  1545.   :RETURN
  1546.   SET GET=Return
  1547.   GOTO END
  1548.   :YES
  1549.   :NO
  1550.   :END
  1551.   Echo The %GET% key was pressed.
  1552.   
  1553.   3. Same example as 2.  This time the Environment is used instead of the
  1554.     ErrorLevel.  Since we are not using Control-C suppression, it is
  1555.     possible to break out of the BATch file with Control-C or Control-Break
  1556.     in this and the previous example. Remember that in many versions of DOS
  1557.  
  1558.  
  1559.  
  1560.  
  1561. Page 24                        GET yes/no aNswer                       GET N
  1562.  
  1563.     the IF subcommand is case sensitive.  GET N converts all alphabetic
  1564.     characters to uppercase, so always use uppercase comparison unless you
  1565.     are using the /L switch.
  1566.   
  1567.   GET N "Answer yes or no (y/n): "
  1568.   IF "%GET%"=="~" GOTO ESCAPE
  1569.   IF "%GET%"=="}" GOTO RETURN
  1570.   IF "%GET%"=="Y" GOTO YES
  1571.   IF "%GET%"=="N" GOTO NO
  1572.   SET GET=Break
  1573.   GOTO END
  1574.   :ESCAPE
  1575.   SET GET=Escape
  1576.   GOTO END
  1577.   :RETURN
  1578.   SET GET=Return
  1579.   GOTO END
  1580.   :YES Put your code for Yes on lines after this label.
  1581.   GOTO END
  1582.   :NO  Put your code for No on lines after this label.
  1583.   :END
  1584.   Echo The %GET% key was pressed.
  1585.  
  1586.  
  1587.  
  1588.  
  1589. GET T                           Moving Text                          Page 25
  1590.  
  1591.   GET T                                                          Moving Text
  1592.   
  1593.   Syntax: GET T[E] "filespec" ['chars'] [/switches]
  1594.   Input:  file specification containing moving text to be displayed.
  1595.           chars to specify the acceptable characters that can be entered.
  1596.   Output: ErrorLevel - ASCII or surrogate scan code.
  1597.           Environment - character
  1598.   Switches:
  1599.           /E enables enhanced and extended keyboard keys
  1600.           /X enables extended keyboard keys
  1601.   
  1602.   GET T is another special case of GET C which provides a special effect.
  1603.     The prompt information is presented as a moving line of text across the
  1604.     bottom of the screen.  This permits having prompt strings up to 4096
  1605.     characters long, and the motion of the characters helps to catch the
  1606.     users attention.  T requires a file with the prompt string which will be
  1607.     displayed moving across the bottom line of the screen. Currently only
  1608.     standard 25 line screens are supported.  The text file should be plain
  1609.     ASCII without any control characters (No CR, LF, or any other characters
  1610.     below ASCII 32).  To be effective the prompt must be over 80 or more
  1611.     characters long, and to ensure smooth wrap-around the first 79
  1612.     characters should be repeated at the end.  The maximum length for the
  1613.     text of the moving prompt is 4096 characters.  Over that it will be
  1614.     truncated.  T does not accept a number of seconds-to-wait argument at
  1615.     this time so it will wait until a valid key is pressed.
  1616.   
  1617.   The T command can fail with an "Invalid Command" message if the file is
  1618.     not properly specified and cannot be found, or if the prompt string is
  1619.     less than 80 characters.  An ErrorLevel of zero should be tested to
  1620.     determine if the command was successful (see example 2 below).  A prompt
  1621.     string of exactly 80 characters will remain stationary.
  1622.   
  1623.   The question has been asked as to how to go about creating such a long
  1624.     prompt string without carriage returns or other control characters.
  1625.     Many text editors have the capability to do this by turning off word
  1626.     wrap.  A good text editor will let you do just about anything you want
  1627.     to do with `ASCII text.  Most programmers use a text editor instead of a
  1628.     word processor while creating and editing their code. Many word
  1629.     processors will let you use them as text editors by specifying "non-
  1630.     document" mode as appropriate.  As with many things related to
  1631.     programming, trial and error experimentation is often the order of the
  1632.     day.  Sometimes it is called "hacking".
  1633.   
  1634.   EXAMPLES:
  1635.   
  1636.   1. If there is a file on the GET disk named SAMPLE.TXT, enter the
  1637.     following command to see the moving text effect:
  1638.   
  1639.   GET T "SAMPLE.TXT"
  1640.   
  1641.   2.  Example 2 for GET C can easily be modified to use a moving text prompt
  1642.     by changing GET C to GET T and replacing the prompt with the filename as
  1643.     follows.  The timeout option is not effective with GET T.
  1644.  
  1645.  
  1646.  
  1647.  
  1648. Page 26                           Moving Text                          GET T
  1649.  
  1650.   :START
  1651.   GET T "sample.txt" } ~
  1652.   IF NOT ErrorLevel 1 GOTO END
  1653.   IF ErrorLevel 255 GOTO SPACE
  1654.   IF ErrorLevel 126 GOTO ESCAPE
  1655.   IF ErrorLevel 125 GOTO RETURN
  1656.   GOTO START
  1657.   :SPACE
  1658.   Echo The space bar was pressed.
  1659.   GOTO END
  1660.   :ESCAPE
  1661.   Echo The Escape key was pressed.
  1662.   GOTO END
  1663.   :RETURN
  1664.   Echo The Enter key was pressed.
  1665.   :END
  1666.   
  1667.   In this example note the addition of the line IF NOT ErrorLevel 1 GOTO
  1668.     END. If the named file is not found due to not being in the current
  1669.     directory, or not having the correct path or name specified, then GET
  1670.     will report "Invalid Command" and exit with ErrorLevel 0.  The added
  1671.     statement is a check for ErrorLevel equal 0, and should always be
  1672.     included when using the GET T command.  You may include drive and path
  1673.     with the filename, but GET must be able to find it where it is specified
  1674.     to be.
  1675.  
  1676.  
  1677.  
  1678.  
  1679. GET S                           GET String                           Page 27
  1680.  
  1681.   GET S                                                           Get String
  1682.   
  1683.   Syntax: GET S[E] ["prompt"] ['pattern'] [/switches]
  1684.   Input:  "prompt" to be displayed.
  1685.           'pattern' to control character entry
  1686.   Output: ErrorLevel - length of string entered.
  1687.           Environment - string.
  1688.   Switches:
  1689.           /A controls Attribute of prompt
  1690.           /C suppresses Ctrl-Break and Ctrl-C
  1691.           /E enables enhanced and extended keyboard keys
  1692.           /K Kountdown the final 10 seconds
  1693.           /N Suppress carriage return after prompt
  1694.           /S Sound bytes
  1695.           /X enables extended keyboard keys
  1696.           /Wnum Waits num seconds for input
  1697.   
  1698.   S accepts character string input terminated by a carriage return. SE is
  1699.     the same but does not echo user input to the screen.  Instead it echoes
  1700.     dots (...) to indicate the number of characters entered without
  1701.     compromising the actual entry.  The latter is useful for hiding the
  1702.     entry of a password, for example.  Extended and enhanced keys will not
  1703.     be accepted, but break can be suppressed with /C.  The length of the
  1704.     string entered is returned in ErrorLevel.  If the user presses Esc, GET
  1705.     will exit with 0 in ErrorLevel as if a timeout has occurred unless the
  1706.     /X switch is specified as described below.
  1707.   
  1708.   As with GET C, the prompt will be issued and then GET will wait with the
  1709.     cursor on the same line as the prompt for keyboard input.  If a /W is
  1710.     specified, GET will wait the specified number of seconds for the first
  1711.     key to be pressed, then exit with an ErrorLevel of 0 if no key has been
  1712.     pressed.  If any key is pressed during the waiting period, the wait is
  1713.     cancelled and GET waits for the user to press the Carriage Return
  1714.     (Enter) key.
  1715.   
  1716.   When /X is specified, if the user presses Escape, the Escape surrogate
  1717.     will be the result, and if the user presses Return (Enter) before
  1718.     pressing any other keys, the CR surrogate will be the result.  A timeout
  1719.     will produce a 0 (zero) result.  If /X is not specified, all three of
  1720.     these user actions will produce a 0 result.
  1721.   
  1722.     GET S /C now also disables the Esc key as well as Ctrl-C/Break, but only
  1723.     if the /X switch is not included.  With /X the Esc key exit can easily
  1724.     be detected and appropriate action taken so disabling does not seem
  1725.     necessary.  The old /~ switch for GET S has been completely eliminated.
  1726.   
  1727.   /E turns on function keys as Exit keys.  If the user presses a function
  1728.     key (F1-F10 only), and if /E is specified, then the surrogate code
  1729.     (100+scan code) for that function key will be reported.  /E includes /X,
  1730.     so both are not needed.  /E does not turn on Enhanced keys in this case,
  1731.     it only enables F1-F10. This permits something like "F1 for help" to be
  1732.     used.
  1733.   
  1734.   The input buffer for GET S[E] and GET Z[E] is 255 characters.  This allows
  1735.     longer strings to be input, especially for GET Z and GET ZE where the
  1736.     input might be from redirection or from an Environment variable.  The
  1737.     max length of the BATch command line, including substitution of
  1738.  
  1739.  
  1740.  
  1741.  
  1742. Page 28                           GET String                           GET S
  1743.  
  1744.     Environment variables is still limited by DOS to 128 characters - can't
  1745.     change that.
  1746.   
  1747.   Additional sound control features added for use with the /Sn switch. See
  1748.     the description of the /S switch above.
  1749.   
  1750.   The length of a string for the S command can be controlled by creating a
  1751.     pattern of characters equal in number to the maximum length of the
  1752.     string allowed.  If the argument is omitted the default is 255
  1753.     characters.  A beep will be sounded if the maximum length has been
  1754.     reached and more characters are attempted, or if any characters do not
  1755.     match the specified pattern. The maximum length of the input string for
  1756.     GET S is 255 characters.
  1757.   
  1758.   The pattern in the argument specifies the acceptable characters for each
  1759.     position as follows.  Note that the uppercase characters T, A, and Z
  1760.     will cause lowercase characters to be converted to uppercase.
  1761.     Conversions to uppercase will also cause the space character to be
  1762.     converted to ASCII 255.  This will facilitate BATch file checking with
  1763.     the IF subcommand. 
  1764.   
  1765.          tT - any typeable character,     T - a-z will be uppercased.
  1766.          aA - any alphabetic character,   A - a-z will be uppercased.
  1767.          zZ - any alphanumeric character, Z - a-z will be uppercased.
  1768.           9 - any digit 0-9.           Alt-255 - space character only.
  1769.          Any other character must match the character entered exactly.
  1770.   
  1771.   In a sense you can think of Alt-255 as an uppercase space character.
  1772.     Remember that the regular ASCII space is used as a delimiter so the
  1773.     scanning of the pattern stops if an embedded space is encountered.  If
  1774.     you need to specify the space, use the surrogate Alt-255, otherwise use
  1775.     t or T if a space is permitted.  If you are going to test the input with
  1776.     the DOS IF subcommand use Alt-255 or T.  This will cause the space to be
  1777.     converted to an Alt-255 which can be tested.  Unless you are using 4DOS,
  1778.     if you try to test a string which contains a space with IF, you will get
  1779.     the message "Bad command or file name", even with MS DOS 5.0.  This is
  1780.     because COMMAND.COM stops parsing the string when it encounters a space
  1781.     which it considers to be a delimiter even if it is enclosed in quotes.
  1782.   
  1783.   EXAMPLES:
  1784.   
  1785.   1. The following example lets the user type in any characters up to a
  1786.     limit of 255.  The string that is typed in will be in the Environment,
  1787.     and the length of the string in the ErrorLevel.  Because the /X switch
  1788.     is used, if the user presses Esc, the Escape surrogate "~" will be in
  1789.     the Environment and 126 in the ErrorLevel.  If the user presses Ctrl-C
  1790.     or Ctrl-Break, DOS will break out of GET with no change to the GET
  1791.     variable in the environment, and an undefined value in the ErrorLevel,
  1792.     possibly 3 for Ctrl-C.  For this reason it is a good idea to clear the
  1793.     GET variable with the statement SET GET= before issuing the GET S
  1794.     command, or use /C to suppress Ctrl-Break as in the next example.  The
  1795.     /U switch causes lowercase characters in the string to be converted to
  1796.     uppercase to facilitate IF tests.
  1797.   
  1798.     GET S /X /U
  1799.   
  1800.   2. This example asks the user for a password.  It does not echo the entry
  1801.  
  1802.  
  1803.  
  1804.  
  1805. GET S                           GET String                           Page 29
  1806.  
  1807.     to the screen to keep the password secure from prying eyes.  It
  1808.     suppresses Ctrl-Break but allows the BATch file to check to see if the
  1809.     user entered Escape.  The password is limited to 8 alphabetic or numeric
  1810.     characters, and all alpha characters will be converted to uppercase to
  1811.     facilitate testing.  The /a switch causes the error message to be
  1812.     displayed in reverse video, and the /w switch causes GET to immediately
  1813.     exit after displaying the prompt.
  1814.   
  1815.   :START
  1816.   GET SE "Enter your password: " ZZZZZZZZ /C /X
  1817.   if "%GET%"=="~" goto Escape
  1818.   if "%GET%"=="PASSWORD" goto PWOK
  1819.   Rem Display error message in reverse video
  1820.   GET C "Incorrect Password" /a /w
  1821.   goto START
  1822.   :Escape
  1823.   GET N "Do you want to cancel your logon? " 
  1824.   if NOT "%GET%"=="Y" goto START
  1825.   Echo Your logon is cancelled.
  1826.   goto EXIT
  1827.   :PWOK
  1828.   Echo Your logon has been accepted
  1829.   Rem Do whatever is necessary here to complete the logon.
  1830.   :EXIT
  1831.   
  1832.   3. The next example gives the user 30 seconds to respond.  If there is no
  1833.     first name entered within 30 seconds, GET will beep and the BATch file
  1834.     will cycle back to :START and ask the question again.  If there is a
  1835.     timeout on last name, the BATch file will report that the session is
  1836.     cancelled and exit.  Only alphabetic characters are allowed, and the
  1837.     first character will be automatically capitalized.
  1838.   
  1839.   :START
  1840.   GET S "Enter your first name " Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /W30
  1841.   if NOT ErrorLevel 1 goto START
  1842.   SET FIRST=%GET%
  1843.   GET S "Enter your last name " Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /W30
  1844.   if errorlevel 1 goto NAME
  1845.   Echo Your session is cancelled.
  1846.   Rem Do whatever is necessary to cancel session here.
  1847.   goto EXIT
  1848.   :NAME
  1849.   Echo Your name is %FIRST% %GET%
  1850.   :EXIT
  1851.  
  1852.  
  1853.  
  1854.  
  1855. Page 30                        Check Key Buffer                        GET I
  1856.  
  1857.   GET I                                                    Check Key Buffer»
  1858.   
  1859.   Syntax: GET I[E] "prompt"  [/switches]
  1860.   Input:  "prompt" to be displayed.
  1861.   Output: ErrorLevel - ASCII or surrogate scan code.
  1862.           Environment - character
  1863.   Switches:
  1864.           /A controls Attribute of prompt
  1865.           /E enables enhanced and extended keyboard keys
  1866.           /X enables extended keyboard keys
  1867.   
  1868.   I checks to see whether a key has been pressed but it does not wait for a
  1869.     keystroke if none is in the buffer; i.e. if the user has not pressed a
  1870.     key in type-ahead mode.  The character that is waiting will be reported
  1871.     in the same manner as for GET C, but it will remain in the keyboard
  1872.     buffer.  If there is no character waiting, the ErrorLevel will be 0 and
  1873.     GET or the variable specified with /V will be expunged from the
  1874.     Environment.
  1875.   
  1876.   IE will read the key if it is present and report it in the same manner as
  1877.     C, or return 0 and expunge GET from the Environment if no character is
  1878.     waiting.  The difference in the IE command from the C command is that IE
  1879.     does not wait if no key is waiting.  If you specify a zero waiting time
  1880.     for GET C with GET C /W or GET C /W0 it will be functionally equivalent
  1881.     to GET IE.
  1882.     
  1883.   You can control whether Extended or Enhanced keys are to be included in
  1884.     the same manner as for GET C.  A prompt can be included and will be
  1885.     displayed, which makes I useful to "echo" text to the screen like the
  1886.     DOS ECHO command, but with GET you can specify reverse video or color
  1887.     attributes.  But see GET EC below for a better Echo command.
  1888.   
  1889.   One way to make use of GET I is to allow a key to be pressed during boot-
  1890.     up (or while any BATch file is running for that matter), then check to
  1891.     see if a key has been pressed and take action accordingly, but if no key
  1892.     was pressed there will be no delay.  Another use would be in a BATch
  1893.     program that the user is familiar enough with that s/he may anticipate
  1894.     the next question.  GET I could be used to check to see if the user has
  1895.     answered the question before it was asked.
  1896.   
  1897.   EXAMPLES:
  1898.   
  1899.   1. In these examples a GET command (GET U), explained elsewhere, is used
  1900.     to place a key in the keyboard buffer, then GET I checks to see if it is
  1901.     there.  In this first example, the letter "a" is placed in the buffer
  1902.     and GET I reports that "A" is waiting with ErrorLevel 65 and GET=A.  The
  1903.     character "a" will remain in the buffer and will be available to the
  1904.     next program that reads keyboard input.  In this case, neither extended
  1905.     nor enhanced keys will be seen.
  1906.  
  1907.  
  1908.  
  1909.  
  1910. GET I                        Check Key Buffer                        Page 31
  1911.  
  1912.   Rem Simulate user pressing the "a" key.
  1913.   GET U "a"
  1914.   Rem Check to see if the key is in the buffer.
  1915.   GET I
  1916.   if ErrorLevel 1 goto ISTHERE
  1917.   Echo There is no key in the buffer.
  1918.   goto EXIT
  1919.   :ISTHERE
  1920.   Echo The key in the buffer is %GET%.
  1921.   :EXIT
  1922.   Rem Note that if you run this BATch file from the command line, you will
  1923.   Rem see "a" at the next DOS prompt when DOS reads the keyboard buffer.
  1924.   
  1925.   2. Clearing the keyboard buffer.  By using the switch /E, both extended
  1926.     and enhanced keys will be seen as well as all standard keys.  Do not use
  1927.     /E unless you know that all users will have enhanced keyboards.   Note:
  1928.     This example is for illustration only.  A faster method of clearing the
  1929.     buffer is to use the /B switch.
  1930.   
  1931.   :LOOP
  1932.   GET IE /E
  1933.   if ErrorLevel 1 goto LOOP
  1934.   
  1935.   3. Suppose you would like to be able to do a clean boot without any TSR's
  1936.     when you want to run a program such as a disk defragmenter.  You can
  1937.     have GET I check if you have pressed a key, and skip your TSR's in your
  1938.     AUTOEXEC.BAT if you have.
  1939.   
  1940.   GET IE
  1941.   if ErrorLevel 1 goto CONTINUE
  1942.   Rem Load first TSR here.
  1943.   Rem Load Second TSR here.
  1944.   Rem ...
  1945.   Rem Load Last TSR here.
  1946.   :CONTINUE with the rest of your AUTOEXEC.BAT
  1947.  
  1948.  
  1949.  
  1950.  
  1951. Page 32                              Echo                             GET EC
  1952.  
  1953.   GET EC                                                                Echo
  1954.   
  1955.   Syntax: GET EC "string" [/switches]
  1956.   Input:  "string" to be Echoed.
  1957.   Output: ErrorLevel - nothing
  1958.           Environment - nothing
  1959.   Switches:
  1960.           /A controls Attribute of prompt
  1961.           /N No carriage return after prompt
  1962.           /S Sound bytes
  1963.   
  1964.   GET EC provides a more versatile alternative to the DOS ECHO command.  The
  1965.     attribute of the echo can be controlled with the /A switch, and the
  1966.     ending carriage return can be suppressed with the /N switch.
  1967.   
  1968.   The advantages to using this instead of GET I "Hello" is that no
  1969.     ErrorLevel or Environment information is generated and the ending
  1970.     carriage return can be suppressed with /N.  If you want to Echo a
  1971.     printer command, for example, you can do it with GET EC "Esc
  1972.     command">PRN /N. An ANSI.SYS command can be echoed with GET EC "Esc
  1973.     command" /N.  This is much more convenient than fooling around with the
  1974.     PROMPT command.
  1975.   
  1976.     GET EC will take the /Sn switch described above and unconditionally echo
  1977.     the specified tones with or without a "prompt" specified.  All other
  1978.     commands that can produce beeps do so in response to an error condition
  1979.     or a timeout.
  1980.  
  1981.  
  1982.  
  1983.  
  1984. GET Z                        Put String (Zap)                        Page 33
  1985.  
  1986.   GET Z                                                     Put String (Zap)
  1987.   
  1988.   Syntax: GET Z "string" [skip] [/switches]
  1989.           GET Z "&var"   [skip] [/switches]
  1990.   Input:  "string" to be placed in the Environment
  1991.   Output: ErrorLevel - length of string.
  1992.           Environment - string
  1993.   Switches:
  1994.           /A with /W1 puts ASCII value of character in Environment
  1995.           /Wnum maximum length of string to transfer
  1996.           /X starts the skip operation from right to left.  See GET ZE.
  1997.   
  1998.   Z uses the "string" as input.  It will put the string into the Environment
  1999.     as the value of the GET= or /Vvar= variable.  If you include the /M
  2000.     switch, GET will attempt to bypass any secondary environments and put
  2001.     the string in the master Environment.  By "master Environment" is meant
  2002.     the environment of the original command processor that was loaded when
  2003.     you started your computer, as contrasted with what we shall call the
  2004.     "current" Environment defined as that of the command processor that is
  2005.     running the BATch file.  The current Environment will be the same as the
  2006.     master Environment unless a secondary command processor has been
  2007.     invoked. If GET is running under a secondary command processor, GET Z
  2008.     with /M will attempt to bypass the current Environment of the secondary
  2009.     command processor and find the master environment.  In the latter case,
  2010.     the GET variable will not be available to the current BATch file.  See
  2011.     discussion of Environment and Shells.
  2012.   
  2013.     The maximum length of the input string for GET Z and GET ZE is 255
  2014.     characters. This allows longer strings to be input, especially for GET Z
  2015.     and GET ZE where the input might be from redirection or from an
  2016.     Environment variable.  The max length of the BATch command line,
  2017.     including substitution of Environment variables is still limited by DOS
  2018.     to 128 characters - can't change that.
  2019.   
  2020.     With GET you can, for example, put a PATH longer than 128 characters
  2021.     into the Environment.  While it is not recommended, it is possible.  One
  2022.     way to do it with GET is to put your desired long PATH into a one-line
  2023.     text file ending in a carriage return, then read it in with GET.  For
  2024.     example, if your long PATH is in the file LONGPATH.TXT you can use
  2025.   
  2026.      GET ZE /VPATH= <LONGPATH.TXT >NUL
  2027.   
  2028.      By redirecting the output with >NUL you suppress the echo
  2029.      that is produced by DOS when reading the file.
  2030.   
  2031.   If a numerical [skip] argument is specified, it will be taken to specify
  2032.     the number of characters to skip over before transferring the remainder
  2033.     of the string to the environment.  The /W switch can be used to specify
  2034.     the maximum length of the string as described for GET ZE below.  Thus,
  2035.     GET Z can be used to extract a substring from "string" starting with the
  2036.     character after skip and using up to the number of characters specified
  2037.     by /Wnnnn.  If [skip] is omitted the default is 0 meaning to start at
  2038.     the beginning of the string.  NOTE: The use of /W with GET Z and GET ZE
  2039.     is different from the use with other input commands where it denotes a
  2040.     time to wait for input.
  2041.   
  2042.   GET Z can have several uses.  A few that come to mind are: uppercase a
  2043.  
  2044.  
  2045.  
  2046.  
  2047. Page 34                        Put String (Zap)                        GET Z
  2048.  
  2049.     string to test it with the IF subcommand, measure the length of a
  2050.     string, count the number of times through a loop by measuring the length
  2051.     of a string that has a character concatenated on each pass, fill out a
  2052.     string to a fixed length by concatenating blanks and measuring its
  2053.     length, extract a substring from a string.
  2054.   
  2055.   If you use GET Z with /W1 to extract a single character, the ASCII decimal
  2056.     value of the character will be in the ErrorLevel (or 0 if the extraction
  2057.     failed).  Previously GET dutifully reported an ErrorLevel of 1 meaning
  2058.     that you extracted one character, but you already knew that so it wasn't
  2059.     very useful.  Reporting the value of the character provides additional
  2060.     information, and may save another call to GET to make that
  2061.     determination.
  2062.   
  2063.   Furthermore, for GET Z only, if both /W1 and /A (for ASCII) are specified,
  2064.     the ASCII decimal value will be spelled out in the Environment also.
  2065.     This allows it to be available to another BATch command, or another GET
  2066.     command such as GET R.  If the extraction fails such as because the
  2067.     string is empty, or you skip too far, then the Environment variable will
  2068.     still be expunged.
  2069.   
  2070.   GET Z "&var" 
  2071.   
  2072.     Using "&var" in the "prompt" argument for GET Z, where 'var' is the name
  2073.     of an Environment variable, will read the named variable value directly
  2074.     from the environment without using DOS to substitute the value for the
  2075.     name.  When read this way the variable name is case sensitive so must be
  2076.     entered exactly as desired.  
  2077.   
  2078.     NOTE: DOS will not substitute variable values on the command line.  The
  2079.     %VAR% notation only works in BATch files.  However, the GET Z "&VAR"
  2080.     command will work just as well on the command line as it does in a BATch
  2081.     file.  (4DOS will make the %VAR% substitution on the command line.)
  2082.   
  2083.     This is an intriguing addition to GET which may have some interesting
  2084.     applications.  Consider the following BATch file:
  2085.   
  2086.      for %%a in (1 2 3) do set var%%a=%%a
  2087.      for %%a in (1 2 3) do echo %VAR%%a%
  2088.   
  2089.      In general the echo in the second line will not echo the contents of
  2090.     VAR1, VAR2, and VAR3 because DOS does not recursively parse such a
  2091.     statement.  I.e. after DOS substitutes for %%a to get %VAR1%, it does
  2092.     not again parse the line to get the value of VAR1.  We could try several
  2093.     different variations of this theme, including calling a subroutine BATch
  2094.     file, but in general DOS will not parse the lines in the way that we
  2095.     would like it to.
  2096.   
  2097.      Note that we can write it so that 4DOS will parse it correctly, and by
  2098.     a convoluted method DOS can be tricked into doing it, but it requires
  2099.     echoing statements out to a temporary BATch file, and executing the
  2100.     temporary file.  However, now we can do it more easily with GET.
  2101.   
  2102.      The new feature permits GET to read variables directly from the
  2103.     Environment, given the variable name.  The above statements can then be
  2104.     written as follows to achieve the desired result:
  2105.  
  2106.  
  2107.  
  2108.  
  2109. GET Z                        Put String (Zap)                        Page 35
  2110.  
  2111.      for %%a in (1 2 3) do set var%%a=%%a
  2112.      for %%a in (1 2 3) do call echoget %%a
  2113.   
  2114.      ECHOGET.BAT as called is:
  2115.   
  2116.      get z "&VAR%1"
  2117.      Echo %GET%
  2118.   
  2119.      Note the ampersand in GET Z "&VAR%1".  New for GET Z is if the first
  2120.     character of the string is an '&', the remainder of the string will be
  2121.     interpreted as the name of an Environment variable to be read into GET's
  2122.     Environment variable - either GET or /Vvar=.  As seen in the example
  2123.     this permits a pseudo indexing of variables; e.g. VAR1, VAR2, VAR3, etc.
  2124.     The value of each can be set into the GET variable to be operated on by
  2125.     generic BATch statements.  The GET R function could be used to increment
  2126.     the index, for example.
  2127.   
  2128.      Suppose you want to operate on a list of files.  The file names could
  2129.     be loaded into the environment by SETting FILE1=filename1,
  2130.     FILE2=filename2, etc. These names can be extracted by GET Z "&VAR",
  2131.     maybe something like this:
  2132.   
  2133.      @Echo off
  2134.      Rem Create a temporary auxiliary file:
  2135.      Echo GET R %%N%% /W1 /VN= >LISTFILE.BAT
  2136.      Echo GET Z "%%1" /VFILE%%N%%=>>LISTFILE.BAT
  2137.      set N=0
  2138.      Rem The next line puts the names of all the BAT files
  2139.      Rem  into the Environment as FILE1, FILE2, etc.
  2140.      For %%a in (*.bat) do call listfile %%a
  2141.      del listfile.bat
  2142.      set J=0
  2143.      Rem Now for DEMO purposes, list out the file names.
  2144.      Rem They could just as easily be operated on in some way.
  2145.      :LOOP
  2146.      GET R %J% /W1 /VJ=
  2147.      GET Z "&FILE%J%"
  2148.      Echo File %J% is %GET%
  2149.      set FILE%J%=
  2150.      IF NOT "%J%"=="%N%" GOTO LOOP
  2151.      set N=
  2152.      set J=
  2153.      set GET=
  2154.   
  2155.     Another advantage of this enhancement is that long variable values can
  2156.     be transferred, which might otherwise cause the BATch command line to be
  2157.     longer than 128 bytes if DOS does the substitution; for example a long
  2158.     PATH string.  The usual skip arg and /Wmax switch can then be used to
  2159.     operate on these longer strings.  To accommodate longer strings, the
  2160.     input buffer has been expanded to 255 characters.
  2161.   
  2162.     When the /M (for Master Environment) switch is used with GET Z "&var",
  2163.     GET will look for the variable in the Master Environment, and if the
  2164.     string is found will store it in the local Environment (which may be the
  2165.     same if there is no secondary command processor, of course.)  This is a
  2166.     different use of the /M switch from other commands, and it provides a
  2167.     means to retrieve a string which was stored in the master environment.
  2168.  
  2169.  
  2170.  
  2171.  
  2172. Page 36                        Put String (Zap)                        GET Z
  2173.  
  2174.   
  2175.     Finally, the &var feature is case sensitive.  Most Environment variable
  2176.     names are in upper case.  A notable exception is the 'windir' variable
  2177.     that Microsoft Windows places in the Environment of DOS sessions.  GET Z
  2178.     "&windir" will retrieve this variable if it is needed for some reason;
  2179.     however, this means the BATch programmer must take care to put other
  2180.     BATch Environment variable names in upper case for the &VAR feature.  
  2181.   
  2182.   MORE EXAMPLES:
  2183.   
  2184.   1. Place a string in the master Environment.  The master Environment will
  2185.     then contain "GET=This is the string" and the ErrorLevel will be the
  2186.     length of the string (18).  To verify that the string was placed in the
  2187.     master Environment, first run a secondary command processor by typing
  2188.     COMMAND at the DOS prompt.  Then run this example and see that the
  2189.     string is not in the current environment by entering SET and viewing the
  2190.     Environment.  Finally, enter EXIT to return to the original command
  2191.     processor and enter SET again to see that the string is actually in the
  2192.     master Environment.
  2193.   
  2194.     GET Z "This is the string" /M
  2195.   
  2196.   2. Suppose you want to fill out a string with blanks to reach a certain
  2197.     fixed length.  In this example let the fixed length be 16.  This is one
  2198.     way to implement a loop and control the number of times the loop occurs.
  2199.     You can either right justify or left justify, and you can append spaces,
  2200.     unlike using the DOS SET command.
  2201.   
  2202.   Rem Get user input, maximum of 16 characters.
  2203.   get s "Enter name: "  tttttttttttttttt /a
  2204.   :FILL If less than 16 characters entered, fill with blanks.
  2205.   if ErrorLevel 16 goto LENOK
  2206.   Rem Append a blank and loop back to check if enough
  2207.   get z "%GET% "
  2208.   goto FILL
  2209.   :LENOK Now we have the length we want.
  2210.   Echo "The string is %GET%"
  2211.   
  2212.   3. Use GET Z to extract the 3rd, 4th, and 5th characters from a string.
  2213.   
  2214.   Rem Turn on GET's reporting feature
  2215.   SET GET?=ON
  2216.   GET Z "abcdef" 2 /w3
  2217.   Environment: cde
  2218.   ErrorLevel: 3
  2219.   
  2220.   4. Suppose there is an Environment variable named VER and that in this
  2221.     case it has the value VER=3.31.  We can extract the DOS minor version
  2222.     with GET Z as follows.
  2223.   
  2224.   GET Z "%VER%" 2
  2225.   Environment: 31
  2226.   ErrorLevel: 2
  2227.   
  2228.   5. Use GET Z to make sure an environment string is in uppercase to
  2229.     facilitate testing it with the BATch IF subcommand.  Spaces will be
  2230.     converted to ASCII-255 otherwise the DOS IF test would fail.  Remember
  2231.  
  2232.  
  2233.  
  2234.  
  2235. GET Z                        Put String (Zap)                        Page 37
  2236.  
  2237.     to use ASCII-255 for the test in your BATch file if there are any
  2238.     spaces.  Let "varname" be the name of a variable in the Environment.
  2239.   
  2240.     GET Z "%varname%" /U /Vvarname=
  2241.     Rem In the next line, the "space" between B and S is really ASCII-255.
  2242.     IF "%varname%"=="BOB STEPHAN" goto NAMEOK
  2243.     Echo The name did not match
  2244.     goto END
  2245.     :NAMEOK
  2246.     Echo The name matched
  2247.     :END
  2248.  
  2249.  
  2250.  
  2251.  
  2252. Page 38                         Standard Input                        GET ZE
  2253.  
  2254.   GET ZE                                                      Standard Input
  2255.   
  2256.   Syntax: GET ZE "prompt" skip [/switches]
  2257.   Input:  "prompt" to be displayed.
  2258.   Output: ErrorLevel - length of string.
  2259.           Environment - string.
  2260.   Switches:
  2261.           /A with /W1 puts ASCII value of character in Environment
  2262.           /Wnum maximum length of string to transfer
  2263.           /X starts the skip operation from right to left.
  2264.   
  2265.   ZE will take input from Standard Input and transfer it to the GET= or
  2266.     /Vvar= variable in the Environment.  The input must be less than 128
  2267.     characters and must be terminated with a carriage return.  ZE will take
  2268.     input from the keyboard, or from redirection or piping.  If you specify
  2269.     a prompt for ZE, it will be displayed before reading standard input.
  2270.     GET ZE works similar to GET S, but uses DOS to obtain the input string
  2271.     from the user; therefore, it is not able to monitor each keystroke and
  2272.     will not be able to suppress Ctrl-Break with the /C switch.  You can
  2273.     force the string to uppercase with the /U switch, or to lowercase with
  2274.     the /L switch.
  2275.   
  2276.   /W can be used with both GET Z and GET ZE to specify the maximum length of
  2277.     the string.  If the input string is longer than the maximum specified
  2278.     with /W, it will be truncated to the length specified.
  2279.   
  2280.   The <skip> argument works for GET ZE as well as GET Z. In order to extract
  2281.     anything when using /X there must be a skip argument.  With /X the skip
  2282.     arg skips from right to left, and the /Wn takes n chars from that
  2283.     position to the RIGHT.  If the /Wn is omitted, everything to the right
  2284.     of the starting position set by skip will be extracted.
  2285.   
  2286.   GET ZE works the same as GET Z except for the source of the string.  Z
  2287.     takes the string from the "string" arg, and GET ZE takes the string from
  2288.     standard input. NOTE: You can save the length of a string as an
  2289.     environment variable with GET # above, or with GET Z with /R (see
  2290.     above).
  2291.   
  2292.   If you use GET Z or ZE with /W1 to extract a single character, the ASCII
  2293.     decimal value of the character will be in the ErrorLevel (or 0 if the
  2294.     extraction failed).  Previously GET dutifully reported an ErrorLevel of
  2295.     1 meaning that you extracted one character, but you already knew that so
  2296.     it wasn't very useful.  Reporting the value of the character provides
  2297.     additional information, and may save another call to GET to make that
  2298.     determination.  Note that for GET ZE the /A switch has its usual meaning
  2299.     of coloring the prompt.
  2300.   
  2301.   EXAMPLES:
  2302.   
  2303.   1. GET S uses the BIOS interrupt to get characters from the user, but you
  2304.     can also use DOS Standard Input with GET ZE.  The prompt will be
  2305.     displayed and the string can be entered from the keyboard for a maximum
  2306.     of 255 characters.  The /U switch can be used to force the environment
  2307.     variable to uppercase, but the user will see it just as it was typed in.
  2308.   
  2309.     GET ZE "Enter a string: "  /U
  2310.  
  2311.  
  2312.  
  2313.  
  2314. GET ZE                         Standard Input                        Page 39
  2315.  
  2316.   2. You can use GET ZE to pipe the current directory into the current
  2317.     Environment by using DOS piping.  This could be used to redirect any
  2318.     standard output into an Environment variable.  Of course, GET Y is the
  2319.     preferred method of putting the current directory into the Environment
  2320.     with GET, but this illustrates the method to do it with any program that
  2321.     writes to standard output.  In some cases piping CD into GET ZE might be
  2322.     preferable because CD includes the drive specification.
  2323.   
  2324.   CD|GET ZE
  2325.   Environment: D:\QPRO
  2326.   ErrorLevel: 7
  2327.   
  2328.   3. You can read the first line of a text file.  If you don't want to see
  2329.     the echo from DOS, redirect the output to NUL.  The general syntax is
  2330.     GET ZE<filespec>NUL.  In this example, the output from the DOS DATE
  2331.     command is redirected to a file, then read in to the Environment with
  2332.     GET ZE, and finally the day of the week is extracted with GET Z.  NOTE:
  2333.     The date could also have been piped directly into GET as in the previous
  2334.     example, but for the purposes of this example an intermediate file is
  2335.     used.
  2336.   
  2337.   Rem Stack <return> to automate the DATE command. 
  2338.   get u 13
  2339.   Rem Use the DOS DATE command to create a file for the date
  2340.   date >date.txt
  2341.   Rem The first line of the file will have the format
  2342.   Rem Current date is Sun 11-17-1991
  2343.   Rem Read the first line into the variable GET=.
  2344.   get ze <date.txt
  2345.   Rem Extract the day of the week in characters 17-19
  2346.   get z "%GET%" 16 /w3
  2347.   Rem The Environment will now contain the variable GET=Sun.
  2348.   Rem
  2349.   Rem NOTE: Different versions of DOS have different formats
  2350.   Rem for the output of the DATE command.
  2351.   Rem
  2352.   Rem Now erase the temporary file.
  2353.   del date.txt
  2354.   
  2355.   4. Extract the minutes and seconds from the DOS TIME command.
  2356.   
  2357.   GET U 13
  2358.   TIME >TIME.DOS
  2359.   GET ZE 22 /W5 <TIME.DOS >NUL
  2360.   NOTE: This is not a reliable method if any users might be using DR DOS or
  2361.     4DOS which have a different format for TIME and DATE.
  2362.  
  2363.  
  2364.  
  2365.  
  2366. Page 40                        Locate Substring                        GET #
  2367.  
  2368.   GET #                                       Locate a Substring in a String
  2369.   
  2370.   Syntax: GET #[E] "string" 'sub' [/switches]
  2371.   Input:  "string" the main string to be searched
  2372.           'sub'    the substring to search for
  2373.   Output: ErrorLevel - location, [E] length of string.
  2374.           Environment - string.
  2375.   Switches:
  2376.           /Wnum offset to start the search
  2377.           /X starts the operation at the right end of the string.
  2378.   
  2379.   GET # is like the BASIC language INSTR (In String) function.  It locates
  2380.     the position of a substring within a string.
  2381.   
  2382.   /X starts the search at the end of the string from right to left.  The
  2383.     substring comparison is still left to right, and the position reported
  2384.     is the offset from the beginning of the string.
  2385.      
  2386.   The result is 0 (zero) if the substring is not found in the string, else
  2387.     it is the location starting with 1 for the leftmost character.  If no
  2388.     'sub' is given, the length of string will be reported.  If /Woffset is
  2389.     specified, the search will begin at the offset specified; thus, a second
  2390.     or subsequent occurrence can be found.  If /x is specified, the offset
  2391.     is counted from right to left.  The search is case sensitive.
  2392.   
  2393.   Note: for GET # you cannot include the single quote character (apostrophe)
  2394.     in the substring.
  2395.   
  2396.   Examples: Command                            Result
  2397.       GET # "D:\subdir\filename.ext" '\'             3
  2398.       GET # "D:\subdir\filename.ext" '\' /w3        10
  2399.       GET # "D:\subdir\filename.ext" '\' /x         10
  2400.       GET # "D:\subdir\filename.ext" '\' /x/w10     10
  2401.       GET # "D:\subdir\filename.ext" '\' /x/w13      3
  2402.    
  2403.   GET #E uses the GET # arguments to Extract the string. After skipping /Wn
  2404.     characters, the substring up to but not including 'sub' will be
  2405.     extracted.  The ErrorLevel is the length of the extracted substring.
  2406.   
  2407.   If /X is specified, the substring in 'sub' plus everything to the right
  2408.     except the first character will be extracted.  On the basis that it is
  2409.     easier in BATch files to catenate strings rather than shorten them, the
  2410.     first character of the target string is likely to be a delimiter of some
  2411.     sort, for example the '\' in a filespec, or the white space between
  2412.     words.  The below examples demonstrate how easy it is to extract
  2413.     portions of a filespec.
  2414.   
  2415.   Examples: Command                            Result            ErrorLevel
  2416.       GET #E "D:\subdir\filename.ext" ':'          D                      1
  2417.       GET #E "D:\subdir\filename.ext" '\'          D:                     2
  2418.       GET #E "D:\subdir\filename.ext" '\' /w3      subdir                 6
  2419.       GET #E "D:\subdir\filename.ext" '\' /x       filename.ext          12
  2420.       GET #E "D:\subdir\filename.ext" '.' /x       ext                    3
  2421.       GET #E "D:\subdir\filename.ext" '\' /x/w10   filename.ext          12
  2422.       GET #E "D:\subdir\filename.ext" '\' /x/w13   subdir\filename.ext   19
  2423.   
  2424.   Note:  There may be a confusing difference between the use of /Wn for GET
  2425.  
  2426.  
  2427.  
  2428.  
  2429. GET #                        Locate Substring                        Page 41
  2430.  
  2431.     Z[E] and GET #E.  For GET Z /Wn specifies the maximum width. For GET #
  2432.     /Wn specifies the offset to start the extraction.  In retrospect it
  2433.     would seem to be better to reverse the meaning of 'arg' and /W for GET
  2434.     Z[E], but this would make it incompatible with the previous release.
  2435.   
  2436.   The /T trim switches can be used to trim blanks and Alt-255 characters
  2437.     from either or both ends of the extracted string.
  2438.  
  2439.  
  2440.  
  2441.  
  2442. Page 42                           'Rithmetic                           GET R
  2443.  
  2444.   GET R                                                           'Rithmetic
  2445.   
  2446.   Syntax: GET R[E] ["+-*/!=&#^~"] [num1] [/Wnum2] [/switches]
  2447.   Input:  one or two numbers, maximum of 65535.
  2448.   Output: ErrorLevel - result modulo 256.
  2449.           Environment - arithmetic result
  2450.   Switches:
  2451.           /A ASCII character in Environment
  2452.           /Wnum2 the second number for the arithmetic operation
  2453.           /H Environment result in Hexadecimal
  2454.   
  2455.   R (for 'Rithmetic) performs arithmetic on two numbers. If no arithmetic
  2456.     symbol is given in quotes then:
  2457.             GET R defaults to add the two numbers
  2458.             GET RE subtracts the second from the first
  2459.             The defaults for num1 and num2 are 0 (zero).
  2460.             /H reports the final Environment result in Hexadecimal
  2461.   
  2462.   When numerical input is used for an argument or with /W, the numbers can
  2463.     be as large as 65535. The arithmetic result is in both the Environment
  2464.     and ErrorLevel. If only one number is given, the other number defaults
  2465.     to 0.  Thus a character representation of a number can be converted to a
  2466.     number in the ErrorLevel.  See examples below for information about
  2467.     results larger than 255 or negative.
  2468.   
  2469.   One of the following arithmetic symbols may be entered as the "prompt"
  2470.     argument.
  2471.   
  2472.       Symbols: "+"  the default, adds the two numbers.
  2473.   
  2474.                "-"  subtracts num2 from num1
  2475.   
  2476.                "*"  multiplies the two numbers.  The maximum product is
  2477.                     655,350.  If the multiplication produces a larger 
  2478.                     product an asterisk will be used to indicate that the
  2479.                     result is too large. Note num2 defaults to 0, so if
  2480.                     it is not specified, the result will be 0.
  2481.   
  2482.                "/"  divides num1 by num2 by integer arithmetic.  Only
  2483.                     the quotient is returned.  See NOTE below.
  2484.   
  2485.                "!"  modulo arithmetic.  Divides num1 by num2 and returns
  2486.                     only the remainder.
  2487.   
  2488.            NOTE:    Division by zero is invalid.  If num2 is omitted,
  2489.                     or is 0, the result will be num1 for "/" or "!".
  2490.                     If num1>255 the result will be num1 modulo 256.
  2491.   
  2492.                "="  compares num1 and num2 and returns one of:
  2493.                     0 if num1<num2
  2494.                     1 if num1=num2
  2495.                     2 if num1>num2.
  2496.                     This makes it easy to use ErrorLevel to check for
  2497.                     >= or <= as well as one of the above.
  2498.   
  2499.                "&"  Bitwise logical AND
  2500.                     Syntax: GET R "&" num1 /wnum2
  2501.  
  2502.  
  2503.  
  2504.  
  2505. GET R                           'Rithmetic                           Page 43
  2506.  
  2507.                     Result: num1 .AND. num2
  2508.   
  2509.                "#"  Bitwise logical OR
  2510.                     Syntax: GET R "#" num1 /wnum2
  2511.                     Result: num1 .OR. num2
  2512.   
  2513.                "^"  Bitwise logical XOR
  2514.                     Syntax: GET R "^" num1 /wnum2
  2515.                     Result: num1 .XOR. num2
  2516.   
  2517.                "~"  Bitwise logical NOT
  2518.                     Syntax: GET R "~" num1
  2519.                     Result: .NOT. num1
  2520.   
  2521.   
  2522.       $num indicates that num is in Hexadecimal if a number is expected.
  2523.     This is useful for GET R and can be used anyplace a numerical arg or
  2524.     parameter is expected.
  2525.   
  2526.       The # sign works as a prefix to an ASCII character and means use this
  2527.     character as a number.  Thus you can perform arithmetic using the
  2528.     numerical value of ASCII characters.  The # character, like the $
  2529.     character for hex, can be used wherever numerical input is expected;
  2530.     however, with the # character only one character immediately following
  2531.     it is converted to the ASCII value of that character.  These conversions
  2532.     will be most useful with GET R.
  2533.   
  2534.       /H provides a generalized Hexadecimal capability.  Whenever numerical
  2535.     output is expected in the Environment, /H will convert the output to
  2536.     Hexadecimal. 
  2537.   
  2538.       The /A (for ASCII) switch in the case of GET R, means put the
  2539.     ErrorLevel in the Environment as an ASCII character.
  2540.   
  2541.   
  2542.   EXAMPLES:
  2543.   
  2544.   1. Convert a numerical Environment variable to an ErrorLevel.  Suppose the
  2545.     following string is in the Environment: VAR=45. Then
  2546.   
  2547.   GET R %VAR%
  2548.   
  2549.   will set the ErrorLevel to 45, and place GET=45 in the Environment.
  2550.   
  2551.   2. Suppose you need to set up a loop in a BATch file.  You can do it this
  2552.     way.
  2553.   
  2554.   SET COUNT=0
  2555.   :LOOP
  2556.   GET R %COUNT% /W1 /VCOUNT=
  2557.   Echo The count is %COUNT%
  2558.   IF NOT ERRORLEVEL 10 GOTO LOOP
  2559.   
  2560.   3. You can use GET R to pass a return code from a CALLed BATch file to its
  2561.     parent.  Of course, this could have been done by SETting and
  2562.     Environement variable, but with GET R you can use the ErrorLevel if you
  2563.     want.
  2564.  
  2565.  
  2566.  
  2567.  
  2568. Page 44                           'Rithmetic                           GET R
  2569.  
  2570.   
  2571.   Echo This is the child batch file.
  2572.   Rem Set the default ErrorLevel to 0, suppress Environment variable.
  2573.   GET R 0 /V-
  2574.   Rem Now make tests and set ErrorLevel accordingly.
  2575.   If "%COMSPEC%"=="C:\COMMAND.COM" get r 1 /V-
  2576.   If "%COMSPEC%"=="C:\4DOS.COM" get r 4 /V-
  2577.   
  2578.   @Echo off
  2579.   Rem This is the parent file.
  2580.   CALL CHILD
  2581.   If ErrorLevel 4 Echo 4DOS is loaded.
  2582.   If ErrorLevel 1 Echo COMMAND.COM is loaded.
  2583.   If Not ErrorLevel 1 Echo Unknown command processor.
  2584.   
  2585.   4. If the result is greater than 255, the ErrorLevel is modulo 256.
  2586.      For example: 256=0, 257=1, ..., 511=255, 512=0, etc.
  2587.   
  2588.   set GET?=on
  2589.   GET R 195 /W350
  2590.   Environment: 545
  2591.   ErrorLevel: 33
  2592.   
  2593.   5. GET uses simple computer integer arithmetic.  Negative numbers are not
  2594.     recognized as such.  If a larger number is subtracted from smaller, the
  2595.     result is 65536 minus the absolute value of the difference.
  2596.     
  2597.   GET RE 10 /W20
  2598.   The ErrorLevel is 246
  2599.   The Environment is 65526
  2600.   
  2601.   6. Convert a hexadecimal number to decimal
  2602.   
  2603.   GET R $ABC
  2604.   Environment: 2748
  2605.   ErrorLevel: 188
  2606.   NOTE: Since the ErrorLevel is limited to a max of 255, the result
  2607.   is reported modulo 256.
  2608.   
  2609.   7. Add a hexadecimal number to a decimal number
  2610.   
  2611.   GET R 10 /W$A
  2612.   Environment: 20
  2613.   ErrorLevel: 20
  2614.   
  2615.   8. Add a hexadecimal number to a decimal number, result in hex
  2616.   
  2617.   GET R 10 /W$A /h
  2618.   Environment: 14
  2619.   ErrorLevel: 20
  2620.   
  2621.   9. You want a single digit for the month to use in 
  2622.   constructing a filename.  Suppose the month is December.
  2623.   
  2624.   GET H 4 /H
  2625.   Environment: C
  2626.   ErrorLevel: 12
  2627.  
  2628.  
  2629.  
  2630.  
  2631. GET R                           'Rithmetic                           Page 45
  2632.  
  2633.   
  2634.   10. Suppose you want a series of characters A, B, C, D, E to 
  2635.   construct 5 filenames.  With the new methods only one call to
  2636.   GET within the loop is necessary.
  2637.   
  2638.   Rem Establish starting point of first character - 1.
  2639.   GET R "-" #A /W1 /VC= /A
  2640.   Rem Convert the value for the last character.
  2641.   GET R #E /VN=
  2642.   :NAMELOOP
  2643.   Rem Convert last char to num, add 1, and convert back to char.
  2644.   GET R "+" #%C% /W1 /VC= /A
  2645.   Echo Character %C% can be used in a name.
  2646.   IF NOT ERRORLEVEL %N% GOTO NAMELOOP
  2647.   SET C=
  2648.   SET N=
  2649.   
  2650.   11. Convert a hexadecimal number to an ASCII Character
  2651.   
  2652.   GET R $4F /A        
  2653.   Environment: O
  2654.   ErrorLevel: 79
  2655.   
  2656.   12. Add a hexadecimal number to an ASCII Character, and convert
  2657.   the result to an ASCII character.
  2658.   
  2659.   GET R #A /W$A /A
  2660.   Environment: K
  2661.   ErrorLevel: 75
  2662.   
  2663.   13. Add a hexadecimal number to an ASCII Character, result in hex
  2664.   
  2665.   GET R #A /W$20 /h
  2666.   Environment: 61
  2667.   he ErrorLevel is: 97
  2668.  
  2669.  
  2670.  
  2671.  
  2672. Page 46                      Clear (Blank) Screen                      GET B
  2673.  
  2674.   GET B                                                 Clear (Blank) Screen
  2675.   
  2676.   Syntax: GET B[E] [New attribute] [/switches]
  2677.   Input: desired new attribute in decimal for B, hex for BE.
  2678.   Output: ErrorLevel - old attribute (decimal of course).
  2679.           Environment - old attribute in decimal, hex for BE.
  2680.   Switches:
  2681.           /Anum can be used for new Attribute
  2682.           /Wnum number of rows on the screen
  2683.           /X reports the old number of lines instead of attribute
  2684.   
  2685.   B the screen Blanker actually performs a clear screen, not a true blanking
  2686.     which leaves the screen display intact but merely hides it.  By doing
  2687.     so, it is able to control the screen attribute (color).   GET B uses
  2688.     your color settings unless you give it a different attribute to use.  It
  2689.     automatically adapts to any number of lines on the screen (e.g. EGA 43
  2690.     or VGA 50).
  2691.   
  2692.   If an attribute argument is given it is taken to be a 1, 2, or 3-digit
  2693.     decimal number that is converted to a two-digit hexadecimal number for
  2694.     the attribute.  The same table of colors and attributes that is used for
  2695.     the /A switch is used for the GET B command.
  2696.   
  2697.   GET B can also use the same attributes with /A that the prompt uses. The
  2698.     /W switch can be used with GET B to set the number of roWs on the screen
  2699.     for EGA or VGA monitors.  GET B /W25 sets the screen to 25 line mode.
  2700.     GET B /W43 sets EGA screens to 43 line mode, and VGA screens to 50 line
  2701.     mode.  If the /X switch is used, GET B will return the current number of
  2702.     lines on the screen instead of the video attribute.  This is done by
  2703.     using a BIOS call to load either the default 8x14 or 8x8 font table.
  2704.     Your number of lines may vary depending on your EGA or VGA BIOS. To
  2705.     get 25 line mode, it may work better to use GET V 3 to set video mode 3
  2706.     instead of GET B /W25.
  2707.   
  2708.   BE regards an argument as a 1 or 2-digit hex number, and the GET value in
  2709.     the Environment is in hex.  With GET BE the number will be taken to be
  2710.     in hex whether it has a $ or not, and the Environment value is in hex.
  2711.     GET B can take a $hex number as input but will report in decimal unless
  2712.     /H is used.
  2713.   
  2714.   EXAMPLES:
  2715.   
  2716.   1. Do a simple ClearScreen (CLS) without changing colors or number of
  2717.     lines.  Suppose the old attribute was black and white.
  2718.   
  2719.   Rem Turn on GET reporting feature
  2720.   SET GET?=ON
  2721.   GET B
  2722.   Environment: 7
  2723.   ErrorLevel: 7
  2724.   
  2725.   2. Set color to blue background with white text.  Save the old attribute
  2726.     in the environment variable ATTR.
  2727.   
  2728.   GET B 23 /VATTR=
  2729.   Environment: 7
  2730.   ErrorLevel: 7
  2731.  
  2732.  
  2733.  
  2734.  
  2735. GET B                      Clear (Blank) Screen                      Page 47
  2736.  
  2737.   
  2738.   3. Restore the saved attribute.
  2739.   
  2740.   GET B %ATTR%
  2741.   Environment: 23
  2742.   ErrorLevel: 23
  2743.   Rem Turn off GET reporting feature
  2744.   SET GET?=
  2745.  
  2746.  
  2747.  
  2748.  
  2749. Page 48                       Get/set video mode                       GET V
  2750.  
  2751.   GET V                                                   Get/set video mode
  2752.   
  2753.   Syntax: GET V [New mode] [/switches]
  2754.   Input: optional new video mode.
  2755.   Output: ErrorLevel - old mode
  2756.           Environment - old mode
  2757.   Switches:
  2758.          Global switches only
  2759.   
  2760.   V reports and optionally sets the video mode.  Don't change Video mode
  2761.     unless you have a specific reason for doing so to prevent setting a mode
  2762.     that is not supported by the system running the BATch file.
  2763.   
  2764.   The following Video Display Mode table is excerpted from "The New Peter
  2765.     Norton Programmer's Guide to The IBM PC & PS/2," page 72.
  2766.   
  2767.       Mode #    Type        Resolution    Colors     Video Subsystem
  2768.        0, 1     Text        40 x 25         16       CGA, EGA, MCGA, VGA
  2769.        2, 3     Text        80 x 25         16       CGA, EGA, MCGA, VGA
  2770.        4, 5     Graphics    320 x 200       4        CGA, EGA, MCGA, VGA
  2771.        6        Graphics    640 x 200       2        CGA, EGA, MCGA, VGA
  2772.        7        Text        80 x 25         Mono     CGA, EGA, MCGA, VGA
  2773.        8, 9, 10                                      PCjr only
  2774.        11, 12                                        Used internally
  2775.        13       Graphics    320 x 200       16       EGA, VGA
  2776.        14       Graphics    640 x 200       16       EGA, VGA
  2777.        15       Graphics    640 x 350       Mono     EGA, VGA
  2778.        16       Graphics    640 x 350       16       EGA, VGA
  2779.        17       Graphics    640 x 480       2        MCGA, VGA
  2780.        18       Graphics    640 x 480       16       VGA
  2781.        19       Graphics    320 x 200       25       MCGA, VGA
  2782.   
  2783.   EXAMPLES:
  2784.   
  2785.   1. Get the current video mode and save it in the variable VIDEO.  Change
  2786.     to video mode 2.  Later restore the original mode.
  2787.   
  2788.   GET V 2 /vvideo=
  2789.   Rem Do what you need to with mode 2
  2790.   Rem Restore original mode
  2791.   GET V %VIDEO%
  2792.   Rem Clear out VIDEO variable
  2793.   SET VIDEO=
  2794.   
  2795.   2. Suppose you have an "ill behaved" program such as a game that leaves
  2796.     the video in a graphics mode when it exits.  You can save the orginal
  2797.     mode before executing the game, then restore it later.
  2798.   
  2799.   Rem Store original video mode
  2800.   GET V /vvideo=
  2801.   Rem Run the ill behaved game
  2802.   GAME
  2803.   Rem Restore original mode
  2804.   GET V %VIDEO%
  2805.  
  2806.  
  2807.  
  2808.  
  2809. GET VE                      Get/set video border                     Page 49
  2810.  
  2811.   GET VE                                                Get/set Video border
  2812.   
  2813.   Syntax: GET VE [New color] [/switches]
  2814.   Input: optional new border color for VE.
  2815.   Output: ErrorLevel - old color
  2816.           Environment - old color
  2817.   Switches:
  2818.          Global switches only
  2819.   
  2820.   VE will get/set the border color on a VGA or EGA monitor.  See the color
  2821.     table below.  One interesting use is to set different border colors for
  2822.     each of your DESQview windows if you are a DV user. GET VE will take any
  2823.     of the 8 basic color codes 0-7.  The additional combinations that can be
  2824.     used for /A or GET B have no meaning for GET VE.
  2825.   
  2826.           The color codes are:
  2827.              0 Black         2 Green      4 Red          6 Brown
  2828.              1 Blue          3 Cyan       5 Magenta      7 White
  2829.   
  2830.   EXAMPLES:
  2831.   
  2832.   1. Set the border color to red.  It was black.
  2833.   
  2834.   Rem Turn on GET reporting feature
  2835.   SET GET?=ON
  2836.   GET VE 4
  2837.   Environment: 0
  2838.   ErrorLevel: 0
  2839.   Rem Turn off GET reporting feature
  2840.   SET GET?=
  2841.  
  2842.  
  2843.  
  2844.  
  2845. Page 50                          Date and Time                         GET H
  2846.  
  2847.   GET H                                                        Date and Time
  2848.   
  2849.   Syntax: GET H[E] ["prompt"] code [/switches]
  2850.   Input: Code from the table below
  2851.   Output: ErrorLevel - H: date or time value specified by code
  2852.                        HE: country code
  2853.           Environment - date or time value(s) specified by code
  2854.   Switches:
  2855.          /A include leading 0's.
  2856.          /C Compressed date
  2857.          /Sn Overrides country code for date format
  2858.          /Wnum Wait num seconds
  2859.          /X/Wnum Wait until time in 24 hour format
  2860.   
  2861.   H The H Date and Time command works differently than most of the others.
  2862.     The value to be obtained is determined by a coded numerical argument.
  2863.     The codes are as follows with 1 being the default.
  2864.         1 Day of the Week - Sunday=0           16 Hour
  2865.         2 Day of the Month                     32 Minute
  2866.         4 Month - January=1                    64 Second
  2867.         8 Year                    128 Odd or Even (H only)
  2868.       512 2-digit year            256 100ths of seconds (H only)
  2869.   
  2870.   For GET H, only one value is returned for each call of GET.  The
  2871.     Environment will contain the character representation of the ErrorLevel,
  2872.     except for Year, or for the Odd/Even feature, or if no code is given.
  2873.     Since ErrorLevel has a maximum of 255, only the last two digits of the
  2874.     year will be reported, but the Environment will have the full value.  If
  2875.     no code is given, the ErrorLevel will contain the default Day of the
  2876.     Week but no Environment variable will be created.
  2877.   
  2878.   The Odd/Even feature is obtained by adding 128 to the desired code.  The
  2879.     Environment will contain the value for the code, but the ErrorLevel will
  2880.     be 1 if the value is odd or 0 if it is even.  This provides a means to
  2881.     alternate doing something like running COMPRESS on C: on even days and
  2882.     D: on odd days.  A code of 128 by itself will put the odd or even
  2883.     indicator for the Day of the Week in the ErrorLevel but no Environment
  2884.     variable will be created.
  2885.   
  2886.   The code 256 specifies the result to be 100ths of seconds. Code 156 like
  2887.     code 128 works only with GET H, not GET HE.  Also remember that code 128
  2888.     is the only one that can be combined with another code for GET H since
  2889.     GET H returns a single result.
  2890.   
  2891.   HE will place a concatenated string in the environment.  You can "build
  2892.     your own" string.  HE requires that you add up the codes for the values
  2893.     you want concatenated.  With this form of the command the ErrorLevel is
  2894.     the length of the GET variable, but it is not very meaningful or useful.
  2895.     128 and 256 do nothing for HE either.
  2896.   
  2897.   GET HE displays a 4-digit year if code 8 is included in the argument. This
  2898.     permits years after 1999 to be reported and used.   Note: In some
  2899.     earlier versions of DOS and 4DOS the DATE command did not accept a 4-
  2900.     digit year.  Current versions work OK. The ErrorLevel for Year is Year-
  2901.     1900, thus 2000 will be 100, etc.
  2902.   
  2903.   GET HE now will check for a /A switch, and if found will not substitute a
  2904.  
  2905.  
  2906.  
  2907.  
  2908. GET H                          Date and Time                         Page 51
  2909.  
  2910.     leading blank for a leading 0; i.e., will include leading 0's.
  2911.   
  2912.   If you can find a use for it with HE, you can include a "prompt" string in
  2913.     double quotes.  The Environment variable will contain the prompt string
  2914.     with the requested date and/or time information concatenated.
  2915.   
  2916.   /Wnum now means wait for the given number of seconds, then report. /X/Wnum
  2917.     means wait until a minute in 24 hour time, then report. NOTE: The 24
  2918.     hour time specification must be in military format, no punctuation;
  2919.     e.g., 1135, 0300, 1056, etc.  Use 2400 for midnight, not 0000.
  2920.   
  2921.   In either case the wait cannot be longer than 18 hours (65535 seconds).
  2922.     If the 24 hour time is longer than 18 hours hence, it will be reduced to
  2923.     18 hours.  If a number of seconds greater than /W65535 is specified, the
  2924.     results are unpredictable.  If the 24 hour time specification is less
  2925.     than the current time, it will be interpreted as meaning going past
  2926.     midnight to the given time on the next day.  Internally GET C is used to
  2927.     process the waiting time, thus the wait can be interrupted by pressing
  2928.     any key.  If a "prompt" is included, it will be displayed during the
  2929.     wait.  Any switches will be used for GET C also, thus /A can be used to
  2930.     control the attribute of the prompt.  However, no character 'arg' will
  2931.     be recognized, so any key will interrupt the wait.
  2932.   
  2933.   Although it was possible to accomplish the same thing with GET C /W in
  2934.     previous versions, this feature will make it easier and more precise to
  2935.     specify waiting times in BATch files.  If necessary to wait more than 18
  2936.     hours, more than 1 call to GET can be used to wait various lengths of
  2937.     time, each no more than 18 hours.
  2938.   
  2939.   The date and time functions in GET (H and F) will now report the dates and
  2940.     times in the format specified by the country code that is currently in
  2941.     use. 
  2942.   
  2943.     As an adjunct to this change, GET HE now reports the country code in the
  2944.     ErrorLevel.  Previously GET HE reported the length of the date/time
  2945.     string which probably was of no use for any application. If the country
  2946.     code is greater than 254, the ErrorLevel will be maxed out at 255.  This
  2947.     would affect Portugal, Finland, Israel, and some Arabic language
  2948.     countries.  Note that country codes are usually the international
  2949.     telephone prefix.
  2950.   
  2951.     GET H[E] 2-digit year
  2952.   
  2953.     Code 512 has been added as an option for GET H[E].  If 512 is added to
  2954.     the coded numerical argument, the year will be placed in the Environment
  2955.     as the rightmost 2 digits only.  Code 512 can either replace 8 or it can
  2956.     be added to 8.  Either value will produce the 2-digit year.  NOTE: Since
  2957.     the previous version it has been possible to obtain a 2-digit year by
  2958.     adding /R to GET H, but there was no easy way to do it with GET HE.
  2959.   
  2960.     GET HE/FE Date format override.  The date format will default to the
  2961.     format for the country specified in DOS.  You can override the format
  2962.     with the /Sn switch where n can be 0, 1, or 2 as follows:
  2963.   
  2964.        0    USA format     Month-Day-Year
  2965.        1    Europe format  Day-Month-Year
  2966.        2    Japan format   Year-Month-Day
  2967.  
  2968.  
  2969.  
  2970.  
  2971. Page 52                          Date and Time                         GET H
  2972.  
  2973.   
  2974.     The date separator will retain the value for the country specified for
  2975.     the operating system, but the order of the values will change according
  2976.     to these format codes.  Note that the Japan format with a 2-digit year
  2977.     would be ideal for naming files because they would sort properly in date
  2978.     order.  Use GET HE 518 /s2/a.  However, countries that use a '/' or '.'
  2979.     character for a separator cannot use it in a filename. Therefore another
  2980.     date format feature has also been added.  You can eliminate the
  2981.     separators completely by adding 4 to the date format code with /Sn.
  2982.     Thus n can also be 4, 5, or 6 to suppress the separators and the
  2983.     previous command would be GET HE 518 /S6. As the year 2000 rolls around
  2984.     you might want to use a 4 digit year for proper sorting.  Then the
  2985.     command would be GET HE 14 /S6.  The /A is not necessary with values of
  2986.     4, 5, or 6 because leading 0's will automatically be included.
  2987.   
  2988.     For example, you can create an 8 character filename incorporating the
  2989.     date with a command such as
  2990.   
  2991.     GET HE "XX" 518 /S6
  2992.   
  2993.     where XX can be any two leading characters you want.  /S6 puts the two-
  2994.     digit year first to facilitate sorting, and it also eliminates the
  2995.     delimiters as well as including leading 0's.
  2996.   
  2997.   COMPRESSED DATES with the /C switch (think C for Compressed)
  2998.   
  2999.     GET H and GET F /E report dates in compressed form with /C.  These dates
  3000.     can be used directly to compare the dates between two files or to
  3001.     compare a file date with today's date.  This date format does not have
  3002.     much visual usefulness because it is not directly readable as a date.
  3003.     It can be used to generate unique file names but the names will not be
  3004.     meaningful to view.
  3005.   
  3006.     To report these dates use the /C switch with either GET H /C or GET F
  3007.     filespec /E/C. Other date or file parameters will be ignored but you can
  3008.     use some of the global switches such as /H to report the output in
  3009.     hexadecimal.  The date format is independent of the Country setting and
  3010.     the /S switch, as well as any coded date parameter.  These are ignored
  3011.     and the date is reported as follows.  The /C switch also overrides the
  3012.     Extended functions of GET HE and GET FE/E.
  3013.   
  3014.     The format used is the DOS native internal file date format.  It uses 16
  3015.     bits as follows:
  3016.   
  3017.         BITs  fedcba9  8765  43210
  3018.         Value  Year    Month  Day
  3019.     The year is relative to 1980; e.g., 1995 is 15.  Thus to convert to
  3020.     meaningful numbers it is necessary to first convert to binary format
  3021.     then extract the bit fields manually and convert to numbers.
  3022.   
  3023.     The only meaningful date arithmetic that can be done with these numbers
  3024.     is to find the number of days difference but ONLY if both numbers are
  3025.     within the same month.
  3026.   
  3027.   EXAMPLES:
  3028.   
  3029.   See additional examples under GET F /E for Compressed date usage.
  3030.  
  3031.  
  3032.  
  3033.  
  3034. GET H                          Date and Time                         Page 53
  3035.  
  3036.   
  3037.   1.  This is a rather elaborate BATch file that can be called to provide a
  3038.     formatted date.  Call it SHOWDATE.BAT.  When you call SHOWDATE it will
  3039.     report something like "The date is August 25, 1991".  This information
  3040.     could just as easily be stored as an Environment variable for use by
  3041.     other BATch files and programs.
  3042.   
  3043.   @Echo Off
  3044.   GET H 4
  3045.   If "%GET%"=="12" set MONTH=December
  3046.   If "%GET%"=="11" set MONTH=November
  3047.   If "%GET%"=="10" set MONTH=October
  3048.   If "%GET%"=="9" set MONTH=September
  3049.   If "%GET%"=="8" set MONTH=August
  3050.   If "%GET%"=="7" set MONTH=July
  3051.   If "%GET%"=="6" set MONTH=June
  3052.   If "%GET%"=="5" set MONTH=May
  3053.   If "%GET%"=="4" set MONTH=April
  3054.   If "%GET%"=="3" set MONTH=March
  3055.   If "%GET%"=="2" set MONTH=February
  3056.   If "%GET%"=="1" set MONTH=January
  3057.   Get H 2 /VDAY=
  3058.   Get H 8 /VYR=
  3059.   Echo The date is %MONTH% %DAY%, %YR%
  3060.   
  3061.   2. A GET BATch file can easily be set up to wait until a given time by
  3062.     using the H feature.  In this example the first pair of GET calls checks
  3063.     every 15 minutes for the hour you want to wait until - in this case 11
  3064.     p.m. or 23 in computer parlance.  The next pair of GET calls checks the
  3065.     time once a minute and waits until the minute is 30.  The BATch file
  3066.     will continue executing at 11:30 p.m. or shortly thereafter.
  3067.   
  3068.   @echo off
  3069.   :HOUR Check the hour every 15 minutes.
  3070.   GET C /W900
  3071.   GET H 16
  3072.   if not "%GET%"=="23" goto HOUR
  3073.   :MINUTE Check the minute every 60 seconds.
  3074.   GET C /W60
  3075.   GET H 32
  3076.   if not ErrorLevel 30 goto MINUTE
  3077.   Rem The BATch file will continue here at 11:30 p.m.
  3078.   
  3079.   3.  The above BATch file can be parameterized so it can be called with the
  3080.     hour and minute that you want it to wait until.  Name this BATch file
  3081.     WAITFOR.BAT, then at the DOS prompt enter WAITFOR hour minute.  For
  3082.     example, WAITFOR 23 30.  A BATch file like this can be run in a DESQview
  3083.     window in the background and produce an alarm at a given time, or
  3084.     execute a program in the background or when the computer is unattended.
  3085.     It can easily be tuned down to the minute, or even the second by how
  3086.     fine you make the checkpoint intervals.
  3087.   
  3088.   @echo off
  3089.   :HOUR Check the hour every 15 minutes.
  3090.   GET C /W900
  3091.   GET H 16
  3092.   if not "%GET%"=="%1" goto HOUR
  3093.  
  3094.  
  3095.  
  3096.  
  3097. Page 54                          Date and Time                         GET H
  3098.  
  3099.   :MINUTE Check the minute every 60 seconds.
  3100.   GET C /W60
  3101.   GET H 32
  3102.   if not ErrorLevel %2 goto MINUTE
  3103.   Rem The BATch file will continue here at the hour and minute you specify.
  3104.   Rem Sound your alarm, or do whatever here, for example,
  3105.   Echo ^G  ^G  ^G  ^G  ^G
  3106.   
  3107.   4. Here are some BATch statements I use in my AUTOEXEC.BAT to do some
  3108.     things only once a day, such as run DOS 5.0 MIRROR to save a copy of my
  3109.     system information in case of a crash.  The current date is saved on
  3110.     disk in a BATch file named SETDATE.BAT.  It contains one line, for
  3111.     example: SET DATE=29.  When I CALL SETDATE it stores the last saved date
  3112.     in the Environment as the DATE= variable.  Then I use GET to get today's
  3113.     date and compare it with %DATE%.  If they compare, I know that I have
  3114.     already done my once-a-day procedures and can skip them this time.  If
  3115.     they don't compare, a new SETDATE.BAT is automatically created, and the
  3116.     once-a-day statements are executed.  Follow it through here:
  3117.   
  3118.   Rem Call SETDATE to store the last saved date in the Environment
  3119.   CALL SETDATE
  3120.   Rem Get today's date to compare with.
  3121.   GET H 2
  3122.   Rem Compare the last saved date with today's date.
  3123.   IF "%DATE%"=="%GET%" GOTO DATEOK
  3124.   Rem If false, recreate SETDATE with today's date.
  3125.   ECHO SET DATE=%GET% >SETDATE.BAT
  3126.   Rem Do your once-a-day procedures here; for example ...
  3127.   MIRROR D: E: F:
  3128.   Rem If the dates compared we would skip the above lines
  3129.   Rem thus speeding up succeeding boots.
  3130.   DATEOK:
  3131.   Rem Continue with your AUTOEXEC.BAT here.
  3132.   Rem Run MIRROR on your boot drive and load delete tracking for all drives
  3133.   MIRROR C: /TC /TD /TE /TF
  3134.   
  3135.   5. HE was designed to produce output in the same form required by the DOS
  3136.     DATE and TIME commands.  For example, if you need to temporarily change
  3137.     the system date (or time) and later restore it, you can do it with the
  3138.     following BATch file.
  3139.   
  3140.   @Echo off
  3141.   Rem HE 14 will report mm-dd-yy in the Environment: 14=2+4+8.
  3142.   get HE 14 /VDATE=
  3143.   Rem Now set the date as you need it for whatever reason, for example:
  3144.   DATE 6-15-90
  3145.   Rem Now run the program that requires the new date.
  3146.   Rem . . .
  3147.   Rem Now restore the original date.
  3148.   DATE %DATE%
  3149.   Rem Clear out the DATE variable (unless you want to save it to use again).
  3150.   SET DATE=
  3151.   
  3152.   6. Display the Day of The Week for any date between 1-1-1980 and 12-31-
  3153.     2099, then reset the current date.
  3154.   
  3155.   @echo off
  3156.  
  3157.  
  3158.  
  3159.  
  3160. GET H                          Date and Time                         Page 55
  3161.  
  3162.   set TRY=%1
  3163.   if not "%1"=="" goto TryDate
  3164.   get s "Enter mm-dd-yyyy: " 99-99-9999 /VTRY=
  3165.   :TryDate
  3166.   GET HE 14 /vDAY=
  3167.   date %TRY%
  3168.   GET H 1
  3169.   date %DAY%
  3170.   goto DAY%GET%
  3171.   :DAY6
  3172.   set DOW=Satur
  3173.   goto END
  3174.   :DAY5
  3175.   set DOW=Fri
  3176.   goto END
  3177.   :DAY4
  3178.   set DOW=Thurs
  3179.   goto END
  3180.   :DAY3
  3181.   set DOW=Wednes
  3182.   goto END
  3183.   :DAY2
  3184.   set DOW=Tues
  3185.   goto END
  3186.   :DAY1
  3187.   set DOW=Mon
  3188.   goto END
  3189.   :DAY0
  3190.   set DOW=Sun
  3191.   :END
  3192.   Echo Day of the week for %TRY%: %DOW%day
  3193.   :EXIT
  3194.   Set TRY=
  3195.   Set DAY=
  3196.   Set DOW=
  3197.   Set GET=
  3198.   
  3199.   7. Catenate a "prompt" string with the date.
  3200.   
  3201.   Rem Turn on the GET reporting feature
  3202.   SET GET?=ON
  3203.   GET HE "The date is" 14
  3204.   Environment: The date is  8-29-91
  3205.   ErrorLevel: 20
  3206.   Rem Turn off the reporting feature
  3207.   SET GET?=
  3208.   
  3209.   8. Wait until 3 a.m. the next day (or the same day if after midnight)
  3210.   
  3211.   GET HE 112 /x /w300
  3212.   Environment: 03:00:00
  3213.   ErrorLevel: 8
  3214.   
  3215.   9. Wait for 3600 seconds (1 hour).  Starting time: 11:30 a.m.
  3216.   
  3217.   GET HE 112 /w3600
  3218.   Environment: 12:30:00
  3219.  
  3220.  
  3221.  
  3222.  
  3223. Page 56                          Date and Time                         GET H
  3224.  
  3225.   ErrorLevel: 8
  3226.   
  3227.   10. Wait until 11:30 p.m. the same day.
  3228.   
  3229.   GET HE "Waiting until 2330" 112 /x /w2330
  3230.   Rem the prompt is displayed while waiting.
  3231.   Rem Waiting until 2330
  3232.   REM After the appropriate wait the results of GET HE 112.
  3233.   Environment: 23:30:00
  3234.   ErrorLevel: 8
  3235.  
  3236.  
  3237.  
  3238.  
  3239. GET U                         Keyboard BUffer                        Page 57
  3240.  
  3241.   GET U                                                      Keyboard BUffer
  3242.   
  3243.   Syntax: GET U "chars" num /Wnum [/switches]
  3244.   Input: characters and key codes to place in key buffer
  3245.   Output: ErrorLevel - Number of characters actually stacked
  3246.           Environment - Not used, GET or /V variable will be cleared out.
  3247.   Switches:
  3248.          /Wnum ASCII value for additional character to be stacked
  3249.   
  3250.   U will stack keys in the keyboard bUffer.  "chars" are any ASCII
  3251.     characters you want stacked in double quotes, and the "num"s are decimal
  3252.     representations of values for either ASCII codes or scan codes.  Up to 3
  3253.     digits can be used for either number.  E.g. to end the string with a
  3254.     carriage return use 13 or /W13. To enter a scan code add it to 255.
  3255.     Note that this is purposely different from the scan code surrogates for
  3256.     the GET C command.
  3257.   
  3258.   NOTE: GET U will only work on PC/XT's with BIOS dated 01/10/86 and later,
  3259.     PC/AT's with BIOS dated 11/15/85 and later, and PS/2s!  
  3260.   
  3261.   With GET U you can provide a default entry for a GET S string; however,
  3262.     the DOS keyboard buffer only holds 15 characters, so it has to be rather
  3263.     short.  Use GET U "default" followed by GET S "prompt", and the default
  3264.     string will be entered for the user.  The user can either change it by
  3265.     backspacing or accept it by pressing enter.
  3266.   
  3267.   The ErrorLevel will contain the number of characters or codes actually
  3268.     placed in the buffer.  If the buffer fills up before all the characters
  3269.     or codes are stacked, GET will beep and exit.  By testing the ErrorLevel
  3270.     for the number of characters and codes, you can tell if the stacking was
  3271.     successful.  To make the full buffer available, the /B switch can be
  3272.     used to clear the buffer.
  3273.   
  3274.   EXAMPLES
  3275.   
  3276.   1. The following will stack the word "help" in the buffer and execute it
  3277.     as a command by also stacking the Enter key (ASCII 13 for CR).  To make
  3278.     the stacked command execute, the BATch file must exit to activate the
  3279.     DOS prompt.
  3280.   
  3281.   GET U "help" 13 /B
  3282.   Rem Test that 5 characters were stacked
  3283.   if ErrorLevel 5 goto EXIT
  3284.   Rem Not all characters were stacked, so clear the buffer and exit
  3285.   GET I /B
  3286.   :EXIT
  3287.   
  3288.   2. The scan code for F1 is decimal 59 so use 314 (=59+255). The following
  3289.     command will stack the F1 key (The HELP key for 4DOS): 
  3290.   
  3291.   GET U 314 
  3292.  
  3293.  
  3294.  
  3295.  
  3296. Page 58                         Keyboard BUffer                        GET U
  3297.  
  3298.   
  3299.   3.  Some programs pause when they are loading and require the user to
  3300.     press a key to continue.  If the program does not clear the keyboard
  3301.     buffer, then GET U can stack the keystroke(s) to automate the loading of
  3302.     the program.  It could also automate the first few program command keys.
  3303.     In this example we will stack the characters to bring up a spreadsheet
  3304.     file list in Quattro Pro.
  3305.   
  3306.   Rem /FR is the Retrieve command for Quattro Pro
  3307.   GET U "/FR"
  3308.   Rem Now call Quattro Pro - the spreadsheet list will be displayed.
  3309.   Q
  3310.  
  3311.  
  3312.  
  3313.  
  3314. GET UE                          Shift Locks                          Page 59
  3315.  
  3316.   GET UE                                                         Shift Locks
  3317.   
  3318.   Syntax: GET UE [/Wnum] [/switches]
  3319.   Input: numerical code to set or clear keyboard locks.
  3320.   Output: ErrorLevel - Old value
  3321.           Environment - Old value
  3322.   Switches:
  3323.          /Wnum code for locks to set
  3324.   
  3325.   UE will let you adjust the Caps, Num, and Scroll Locks. Sum the numbers
  3326.     for Scroll=16, Num=32, Caps=64 for the Locks you want to set.  The
  3327.     other(s) will be cleared.  You must use GET UE /Wnum not just GET UE
  3328.     num.  CAUTION: Don't forget the /W.
  3329.   
  3330.   EXAMPLES
  3331.   
  3332.   1. Turn off NumLock and ScrollLock, turn on CapsLock
  3333.   
  3334.   GET UE /W64
  3335.   
  3336.   2. Turn on both NumLock and CapsLock, turn off ScrollLock.
  3337.   
  3338.   Rem Turn on GET reporting feature
  3339.   SET GET?=ON
  3340.   GET UE /W96
  3341.   Environment: 64
  3342.   ErrorLevel: 64
  3343.   
  3344.   3. Turn off all key locks
  3345.   
  3346.   GET UE
  3347.   Environment: 96
  3348.   ErrorLevel: 96
  3349.   Rem Turn off GET reporting feature
  3350.   SET GET?=
  3351.   
  3352.   4. Turn on CapsLock, then restore original setting
  3353.   
  3354.   Rem Turn on Caps and Num Locks to get user input 
  3355.   Rem Save original setting in LOCK.
  3356.   GET UE /W96 /VLOCK=
  3357.   Rem Get string input from user in upper case and numbers.
  3358.   GET S "Enter information now: "
  3359.   Rem Restore original lock settings
  3360.   GET UE /W%LOCK%
  3361.   Rem Clear out the LOCK variable
  3362.   SET LOCK=
  3363.  
  3364.  
  3365.  
  3366.  
  3367. Page 60                 Get DISK and FILE Information                GET 2.7
  3368.  
  3369. GET DISK and FILE Information
  3370.  
  3371. The K, Q, L, F, FP, X, and Y commands obtain information about disks and/or
  3372.   files.  Note that Q, K, and L check to see if the drive contains a
  3373.   formatted disk, and they return an ErrorLevel 0 if it does not.  This
  3374.   avoids the Abort, Retry, etc. error handling.  If the ErrorLevel is 0 the
  3375.   error code will be in %GET% as a hexadecimal value.
  3376.  
  3377. Some error code values of interest when running under DOS are: 
  3378.  
  3379.     1  Invalid drive specified - this new procedure works only for 
  3380.        drives on the primary disk controller, usually A: and B:.
  3381.     2  Address mark not found meaning disk is not formatted
  3382.     6  Floppy disk has been removed.  If this code is returned, try 
  3383.        again since it may persist even if the drive door has been
  3384.        opened and closed again, especially if a disk cache is in use.
  3385.    20  Controller failed meaning disk is not formatted.
  3386.    80  Drive timed out probably because door is open
  3387.  
  3388.   Other codes that may be seen - test on your system:
  3389.     3  disk write protected may mean no diskette in drive.
  3390.     4  sector not found - possible if disk is not formatted.
  3391.     8 and 9  DMA errors (unlikely)
  3392.     C  media type not found - possible if disk is not formatted.
  3393.    10  data error - formatted disk in drive but is unreadable
  3394.    40  seek failed (unlikely) .
  3395.  
  3396. When GET is running in an OS/2 DOS session the old method of checking is
  3397.   still used due to an incompatibility and the old error codes will be
  3398.   reported:
  3399.  
  3400.       0 - Write protected diskette (n/a since GET does not write)
  3401.       1 - Invalid drive letter
  3402.       2 - Drive not ready - no disk or door open.
  3403.       4, 6, 7, 8, & B - Disk read errors
  3404.       C - General, nonspecific error.
  3405.       F - Invalid disk change
  3406.  
  3407.   GET K, Q, and L  /A switch
  3408.  
  3409.   Two methods of testing are available--a standard DOS method, and one that
  3410.   is used in an OS/2 VDM.  The DOS method is faster in DOS but slower and
  3411.   less reliable under OS/2. If the default DOS method does not give the
  3412.   desired results for something you want to do, you can try the /A (for
  3413.   Alternate method) switch to force GET to use the same method that is used
  3414.   under OS/2.  This is the method used by some older versions of GET such as
  3415.   2.5, and it can be very slow if there is an unformatted diskette in the
  3416.   drive.  Remember. the two methods return different error codes as
  3417.   described in the manual.
  3418.  
  3419.   When used on drives other than A: and B: in previous versions of GET, this
  3420.   test often failed due to technical reasons even if valid media was in
  3421.   place, and it interfered with obtaining the size or label of some drives
  3422.   such as removable and network drives.
  3423.  
  3424.  
  3425.  
  3426.  
  3427. GET 2.7                 Get DISK and FILE Information                Page 61
  3428.  
  3429.   GET K, Q, and L /X switch
  3430.  
  3431.   A /X switch has been added to check for a writeable disk in drive A: or
  3432.   B:. First GET checks for a formatted disk in the usual manner of GET Q, K,
  3433.   and L.  If this test fails, the ErrorLevel will be 0 and the return code
  3434.   in the Environment.  If this test passes, then an attempt is made to write
  3435.   to the disk, but no data will actually be written. If the disk is write
  3436.   protected an ErrorLevel of 0 and an Environment variable (error code) of 3
  3437.   will be reported.  If the status cannot be determined, an ErrorLevel and
  3438.   Environment variable of 0 are reported.  If these tests are passed, then
  3439.   the normal return from GET K, Q, or L will be reported.
  3440.  
  3441.   The read and write tests will always be bypassed if the drive is other
  3442.   than A: or B:.  This may be inconvenient for those rare users who have a
  3443.   3rd floppy drive other than A: or B:, but it should be usable in 99.44% of
  3444.   the cases.  It also does not test other types of drives with removable
  3445.   media such as Bernoulli drives.  The benefit of this restriction is that
  3446.   it permits obtaining size and label information on more types of drives
  3447.   including possibly some network drives. This benefit is thought to more
  3448.   than compensate for the occasional Abort, Retry, Ignore type message on
  3449.   the odd removable drive other than A: or B:.
  3450.  
  3451. INTERNATIONAL DATES AND TIMES SUPPORTED
  3452.  
  3453.   The date and time functions in GET (H and F) will now report the dates and
  3454.   times in the format specified by the country code that is currently in
  3455.   use.  (See additional information under GET H below.)
  3456.  
  3457.  
  3458.  
  3459.  
  3460. Page 62                       Get disk free space                      GET K
  3461.  
  3462.   GET K                                                  Get disk free space
  3463.   
  3464.   Syntax: GET K[E] [drive][/Wdiv] [/switches]
  3465.   Input:  drive letter and optionally divisor
  3466.   Output: ErrorLevel - KiloBytes/10, KE - KiloBytes/100
  3467.           Environment - KiloBytes
  3468.   Switches:
  3469.           /A Alternate method to test floppy drive
  3470.           /Wnum divisor for ErrorLevel
  3471.           /X Check for write protected diskette
  3472.   
  3473.   K takes the argument to be a drive letter.  The colon is not required.
  3474.     The default is the current drive.  Optionally a divisor can be included
  3475.     with the /W switch.
  3476.   
  3477.   K, as well as Q and L, starts out by attempting a direct read of the disk.
  3478.     If this fails by reason of one of the errors mentioned above, GET
  3479.     reports the error and exits.  This avoids the annoying "Abort, Retry,
  3480.     Ignore, Fail?" message if the drive is not ready for some reason, and
  3481.     lets the BATch programmer handle the error as appropriate to the
  3482.     application.  If the read is successful, GET K obtains the disk
  3483.     information and calculates the free space.
  3484.   
  3485.   Please see the information at the beginning of this section on "GET DISK
  3486.     and FILE Information" for general information regarding the /A and /X
  3487.     switches.
  3488.   
  3489.   Disk free space is reported in kilobytes (kb) in the Environment.  To
  3490.     verify the value you can take the free space reported by CHKDSK and
  3491.     divide it by 1024, the number of bytes in a kb.  The result should come
  3492.     out exactly.  The value reported in the Environment is the same for GET
  3493.     K and GET KE.
  3494.   
  3495.   Since the ErrorLevel can only report numbers up to 255, GET reduces the
  3496.     value that is reported, but this does not affect the value in the
  3497.     Environment.  For GET K the number of kb is divided by 10, and for GET
  3498.     KE, the kb is divided by 100.  For disks with very large partitions,
  3499.     this may still not reduce the amount reported below 255, so GET also has
  3500.     provisions for an optional programmer supplied divisor.  For example, an
  3501.     argument of /W1024 will divide by 1024, and the ErrorLevel will contain
  3502.     approximate megabytes of free space.
  3503.   
  3504.   EXAMPLES:
  3505.   
  3506.   1. Assume that CHKDSK reports "8,386,560 bytes available on disk".  Then
  3507.   GET K reports
  3508.   
  3509.   Rem Turn on GET reporting feature
  3510.   SET GET?=ON
  3511.   GET K
  3512.   Environment: 8190
  3513.   ErrorLevel: 255
  3514.   
  3515.   In this case 8190 divided by 10 is 819, a figure too large for the
  3516.     ErrorLevel, so the ErrorLevel is set to the maximum value.
  3517.   
  3518.   2. Same assumption as 1.  GET KE reports
  3519.  
  3520.  
  3521.  
  3522.  
  3523. GET K                       Get disk free space                      Page 63
  3524.  
  3525.   
  3526.   GET KE
  3527.   Environment: 8190
  3528.   ErrorLevel: 81
  3529.   
  3530.   In this case the kb is divided by 100 and truncated by integer arithmetic
  3531.     to 81.
  3532.   
  3533.   3. Same assumption as 1.  Suppose we want the free space in megabytes (mb)
  3534.     on drive C:.
  3535.   
  3536.   GET K C /W1024
  3537.   Environment: 8190
  3538.   ErrorLevel: 7
  3539.   
  3540.   In this case, 8190 divided by 1024 is just under 8, but is truncated to 7
  3541.     by the integer arithmetic used.  The BATch file is assured of at least 7
  3542.     mb free.
  3543.   
  3544.   4. Obtain the free space on the diskette in drive B.  Assume that CHKDSK
  3545.     reports 700,416 free.
  3546.   
  3547.   GET K b
  3548.   Environment: 684
  3549.   ErrorLevel: 68
  3550.   Rem Turn off GET reporting feature
  3551.   SET GET?=
  3552.   
  3553.   5.  No diskette in drive A:.  The error may be reported as 2 or C.
  3554.   
  3555.   GET K A
  3556.   if not errorlevel 1 if not "%GET%"=="" goto DiskError
  3557.   Echo The free space on drive A: is %GET%
  3558.   goto exit
  3559.   :DiskError
  3560.   Echo Disk error %GET% on drive A:.
  3561.   :exit
  3562.  
  3563.  
  3564.  
  3565.  
  3566. Page 64                    Get Disk Capacity (Quota)                   GET Q
  3567.  
  3568.   GET Q                                            Get Disk Capacity (Quota)
  3569.   
  3570.   Syntax: GET Q[E] [drive][/Wdiv] [/switches]
  3571.   Input:  drive letter and optionally divisor
  3572.   Output: ErrorLevel - KiloBytes/10, QE - KiloBytes/100
  3573.           Environment - KiloBytes
  3574.   Switches:
  3575.           /A Alternate method to test floppy drive
  3576.           /Wnum divisor for ErrorLevel
  3577.           /X Check for write protected diskette
  3578.   
  3579.   Q reports the capacity of a disk.  GET Q works just like GET K except that
  3580.     it returns the capacity of the disk as if it were empty. Q for Quota?
  3581.     As with K, Q first determines that a formatted disk is present in the
  3582.     drive.  Please see the information at the beginning of this section on
  3583.     "GET DISK and FILE Information" for general information regarding the /A
  3584.     and /X switches.
  3585.   
  3586.   Q will most often be used to determine the type of diskette in a floppy
  3587.     disk drive although it will work on a hard disk as well, if that is of
  3588.     interest.  Before Q can make this determination, the disk must be
  3589.     formatted, so it cannot be used to select the type of formatting to use
  3590.     in a BATch file.
  3591.   
  3592.   For both Q and K the extended command divides the ErrorLevel by 100 but
  3593.     does not change the Environment variable.  If you need a different
  3594.     divisor for the ErrorLevel for K or Q, you can use the /W notation. This
  3595.     divisor feature will be needed to get ErrorLevel information on large
  3596.     partitions.
  3597.   
  3598.   EXAMPLES:
  3599.   
  3600.   1. A 360k diskette is in drive A:.  CHKDSK reports "362,496 bytes total
  3601.     disk space".
  3602.   
  3603.   Rem Turn on GET reporting feature
  3604.   SET GET?=ON
  3605.   GET Q A
  3606.   Environment: 354
  3607.   ErrorLevel: 35
  3608.   
  3609.   That's right, in computer terms there are only 354kb on a nominal 360k
  3610.     diskette after space is set aside for the boot record, FAT, and root
  3611.     directory.  By the way, I think you will find that GET reports faster
  3612.     than CHKDSK in spite of taking time to try the direct read to check for
  3613.     drive ready.
  3614.   
  3615.   2. A 1.2mb diskette is in drive A:.  CHKDSK reports 1,213,952 total.
  3616.   
  3617.   GET QE A
  3618.   Environment: 1185
  3619.   ErrorLevel: 11
  3620.   
  3621.   3. A 720k diskette is in drive B:.  CHKDSK reports 730,416 bytes.
  3622.   
  3623.   GET Q b
  3624.   Environment: 713
  3625.  
  3626.  
  3627.  
  3628.  
  3629. GET Q                    Get Disk Capacity (Quota)                   Page 65
  3630.  
  3631.   ErrorLevel: 71
  3632.   
  3633.   4. A 1.44mb disk is in drive B:.  CHKDSK reports 1,457,664 total bytes.
  3634.   
  3635.   GET Q B
  3636.   Environment: 1423
  3637.   ErrorLevel: 142
  3638.   
  3639.   5. CHKDSK reports 33,449,984 bytes total disk space on drive C:.  Use GET
  3640.     to find the number of megabytes in the ErrorLevel.
  3641.   
  3642.   GET Q c /w1024
  3643.   Environment: 32666
  3644.   ErrorLevel: 31
  3645.   Rem Turn off GET reporting feature
  3646.   SET GET?=
  3647.   
  3648.   6.  There is no drive Z:.  The error may be reported as 1 or C.
  3649.   
  3650.   GET Q Z
  3651.   if not ErrorLevel 1 if not "%GET%"=="" goto DiskError
  3652.   Echo The disk in drive Z: has %GET% kilobyte capacity
  3653.   goto exit
  3654.   :DiskError
  3655.   if %GET%==1 Echo Invalid drive letter: Z.
  3656.   if %GET%==C Echo General failure on drive Z.
  3657.   :exit
  3658.  
  3659.  
  3660.  
  3661.  
  3662. Page 66                        Get volume label                        GET L
  3663.  
  3664.   GET L                                                     Get volume label
  3665.   
  3666.   Syntax: GET L [drive]
  3667.   Input:  optional drive letter
  3668.   Output: ErrorLevel - 1=label found, 0=no label found
  3669.           Environment - Volume Label
  3670.   Switches:
  3671.           /A Alternate method to test floppy drive
  3672.           /X Check for write protected diskette
  3673.   
  3674.   L gets the Volume Label of the specified disk.  The ErrorLevel is 0 if the
  3675.     disk is not labelled, or 1 if the disk has a volume label.  The optional
  3676.     argument is the drive letter, defaulting to the current drive.  If the
  3677.     disk is not labelled, the GET variable will be expunged and the
  3678.     ErrorLevel will be 0.
  3679.   
  3680.     Please see the information at the beginning of this section on "GET DISK
  3681.     and FILE Information" for general information regarding the /A and /X
  3682.     switches.
  3683.   
  3684.   Volume labels can be placed on disks when they are formatted by using the
  3685.     /V switch with the FORMAT command, or later by using the DOS LABEL
  3686.     command, or other labelling utility.  Volume labels can be very useful
  3687.     in identifying and cataloging diskettes, especially when they can be
  3688.     checked automatically with a program such as GET.  Another use is to
  3689.     verify that the user has inserted the correct diskette when running an
  3690.     installation BATch program.
  3691.   
  3692.   Volume labels can be up to 11 characters.  DOS will allow any of the 256
  3693.     ASCII and extended characters except ."/\[]:*|<>;,?, ASCII 0-31, and the
  3694.     lower case alphabetic characters.  (Actually some LABEL programs allow
  3695.     lower case and other characters such as the decimal point, but since DOS
  3696.     converts lower case to caps and will not allow some characters it is
  3697.     better to stick with caps and standard DOS labels.)  Even the space
  3698.     character is allowable in a Volume label.  Therefore, with 184
  3699.     characters to choose from, there is an almost endless set of
  3700.     combinations that you can use.  To enter the extended characters above
  3701.     127 hold down the Alt key while typing the ASCII code on the number pad
  3702.     keys.  (On some systems it is necessary to hold down both the Alt and
  3703.     the Shift keys while typing an extended character.  You may be able to
  3704.     enter ASCII 127 with the Ctrl-BackSpace key.)  The file SCANCODE.DOC
  3705.     with the registered version contains a table of all the ASCII
  3706.     characters.
  3707.   
  3708.   It is often convenient to have a space in a volume label, but most
  3709.     versions of DOS make it difficult to verify such a label with the BATch
  3710.     IF subcommand.  To DOS the space is a delimiter, and the IF comparison
  3711.     will fail, usually with some message such as "Bad command or file name".
  3712.     To work around this problem, GET provides a method to compare a string,
  3713.     which may include one or more spaces, with the volume label of a disk by
  3714.     using the LE command.  The test label is given in the argument and must
  3715.     be enclosed in double quote characters.  The comparison is exact and
  3716.     case sensitive, so get it right the first time.  If the string is less
  3717.     than 11 characters long, do not include any trailing spaces to fill in
  3718.     the 11 characters.  Only the characters up to the last non-space
  3719.     character will be checked and additional spaces will cause the
  3720.     comparison to fail.  If you need to test with the IF subcommand, the /U
  3721.  
  3722.  
  3723.  
  3724.  
  3725. GET L                        Get volume label                        Page 67
  3726.  
  3727.     switch will force lowercase letters (if any) to uppercase, and will
  3728.     convert spaces to ASCII 255 characters.
  3729.   
  3730.   EXAMPLES:
  3731.   
  3732.   1. The disk in drive B: does not have a volume label.
  3733.   
  3734.   Rem Turn on GET reporting feature
  3735.   SET GET?=ON
  3736.   GET L B
  3737.   ErrorLevel: 0
  3738.   
  3739.   2. The disk in drive A: has the volume label BOB STEPHAN.
  3740.   
  3741.   GET L A
  3742.   Environment: BOB STEPHAN
  3743.   ErrorLevel: 1
  3744.   
  3745.   3. The disk in drive A: is not formatted.  The error may be reported as
  3746.     'C' or one of the read error codes above.  Even though there is a value
  3747.     in the environment, the ErrorLevel of 0 is sufficient to determine that
  3748.     the disk does not have a volume label.
  3749.   
  3750.   GET L A
  3751.   if not errorlevel 1 goto NoLabel
  3752.   Echo The label on the disk in drive A: is %GET%
  3753.   goto exit
  3754.   :NoLabel
  3755.   if not "%GET%"=="" goto DiskError
  3756.   Echo There is no volume label on the disk in drive A:
  3757.   goto exit
  3758.   :DiskError
  3759.   Echo Error %GET% reading disk in drive A:
  3760.   :exit
  3761.  
  3762.  
  3763.  
  3764.  
  3765. Page 68                       Match volume label                      GET LE
  3766.  
  3767.   GET LE                                                  Match volume label
  3768.   
  3769.   Syntax: GET LE "label" [drive]
  3770.   Input:  "label" for LE to match, optional drive letter
  3771.   Output: ErrorLevel - 1 =yes, 0=no
  3772.           Environment - Volume Label
  3773.   Switches:
  3774.           /A Alternate method to test floppy drive
  3775.           /X Check for write protected diskette
  3776.   
  3777.   LE takes a trial label in the "label" argument and sets the ErrorLevel to
  3778.     indicate whether the disk label matches.  The comparison is case
  3779.     sensitive and there must not be any trailing blanks in the "label"
  3780.     argument.  The /U and /L switches affect only what is placed into the
  3781.     Enviroment string and do not affect the comparison.
  3782.   
  3783.   EXAMPLES:
  3784.   
  3785.   1. Compare the volume label on the disk in drive A: with the string "BOB
  3786.     STEPHAN"
  3787.   
  3788.   GET LE "BOB STEPHAN" A
  3789.   Environment: BOB STEPHAN
  3790.   ErrorLevel: 1
  3791.   
  3792.   2. Compare the volume label on the disk in drive A: with the string "BOB"
  3793.   
  3794.   GET LE "BOB" A
  3795.   Environment: BOB STEPHAN
  3796.   ErrorLevel: 0
  3797.   Rem Turn off GET reporting feature
  3798.   SET GET?=
  3799.  
  3800.  
  3801.  
  3802.  
  3803. GET F                          Get file size                         Page 69
  3804.  
  3805.   GET F                                                Get file size (DIR=0)
  3806.   
  3807.   Syntax: GET F[E] filespec [/switches]
  3808.   Input: file specification, optionally including path, but no wildcards.
  3809.   Output: ErrorLevel - F: KiloBytes; FE: KiloBytes/10.
  3810.                      With /A: Bytes (up to 255).
  3811.           Environment - file size in KiloBytes, Bytes, or Hex bytes
  3812.   Switches:
  3813.           /A All bytes (full file size)
  3814.           /E reports file date/time (See GET F /E next)
  3815.           /Wnum divisor for ErrorLevel
  3816.           /X Exact file size in Environment in hexadecimal
  3817.   
  3818.   The file specification (filespec) is NOT in quotes and must not contain
  3819.     wild card characters, but may contain drive and path information.
  3820.   
  3821.   F reports file size.  The result is reported as kilobytes which allows
  3822.     sizes up to 261,120 bytes to be reported in the ErrorLevel.  For FE the
  3823.     divisor is 10 so that files up to 2,611,200 bytes can be reported in the
  3824.     ErrorLevel.  The /Wnum switch can be used to specify a divisor for
  3825.     either F or FE in the same manner as for GET K and GET Q.  The size in
  3826.     kilobytes will be divided by the divisor and the result placed in the
  3827.     ErrorLevel.  These divisions affect the ErrorLevel only, the value in
  3828.     the Environment will not be changed.  Values in the Environment can be
  3829.     up to 655,530 kilobytes.  If it is possible to have larger files on your
  3830.     system, the value for a larger file will be reported as an asterisk
  3831.     indicating that the value is not valid, but is larger than 655,530
  3832.     kilobytes (671,262,720 bytes).
  3833.   
  3834.   If /A is specified, All the bytes in the file size will be reported in the
  3835.     Environment for files up to 655,350 bytes.  If over that size, the value
  3836.     will be an asterisk indicating that the size is larger than 655,350
  3837.     bytes. If the file is 255 bytes or less, the full size will be in the
  3838.     ErrorLevel.  The /Wdiv switch can be used to specify a divisor for
  3839.     larger files so that the resulting ErrorLevel will be less than 255.
  3840.     The divisor does not affect the Environment variable.
  3841.   
  3842.   The /X switch will cause the exact file size to be reported in the
  3843.     Environment in hexadecimal.
  3844.   
  3845.   If the filespec cannot be found, the GET variable will be expunged from
  3846.     the Environment and a standard DOS error code will be returned in the
  3847.     ErrorLevel.  (See codes below).
  3848.   
  3849.   Directory existence:  The F command for GET Filesize can be used to
  3850.     determine whether a named directory exists.  If the filespec is a
  3851.     directory, the ErrorLevel will be 0 and the Environment variable will be
  3852.     '0'.
  3853.   
  3854.   GET F will accept a root directory specification and treat it the same as
  3855.     a subdirectory by reporting an ErrorLevel of 0 and setting the
  3856.     Environment variable to 0 also.  However, since the root directory is
  3857.     not a file, the result may be dependent on the version of DOS.  It has
  3858.     only been tested with MS-DOS 5.0 and may work differently on older
  3859.     versions of DOS.  If your application may sometimes use GET F for a root
  3860.     directory, test it with all versions of DOS that it may encounter to
  3861.     determine the results that will be reported.  If an invalid drive is
  3862.  
  3863.  
  3864.  
  3865.  
  3866. Page 70                          Get file size                         GET F
  3867.  
  3868.     specified in the filespec, the ErrorLevel will probably be 3 (path not
  3869.     found) and the Environment variable will be empty.  Remember that GET F
  3870.     does not check for a valid disk in the drive, so if you are checking A:
  3871.     or B: and there is a chance that there may not be a formatted diskette
  3872.     in the drive, use GET K, Q, or L first to verify it.  Checking for a
  3873.     formatted diskette each time would slow GET F down with the extra
  3874.     overhead which is unnecessary in most cases.
  3875.   
  3876.   NOTE: Although it is a documented procedure in MS DOS 5.0, do not use the
  3877.     NUL device to check for a directory if any users might be using DR DOS
  3878.     5.0 or a network.  DR DOS 5 thinks that the NUL (and other) devices
  3879.     exist even in non-existent directories.  It may be that a few other
  3880.     versions of DOS do not support the NUL device method of checking, but
  3881.     GET will work with them all.
  3882.   
  3883.   GET F must open the file for reading in order to obtain the requested
  3884.     information.  This means that GET F may fail on files that cannot be
  3885.     opened in this manner.  Although special handling is implemented for
  3886.     directories (which GET cannot open as files),  there are other cases
  3887.     where GET may return the code 5 meaning "Access denied".  Such cases
  3888.     include, but may not be limited to files on network drives for which
  3889.     read access has not been granted, files opened by other processes,
  3890.     volume label names, and possibly root directories in older versions of
  3891.     DOS.  The following return codes are of particular interest for GET F.
  3892.           2 for "File not found"
  3893.           3 for "Path not found" (this may also be returned for an
  3894.                                   invalid drive specification).
  3895.           5 for "Access denied"
  3896.          15 for "Invalid drive"
  3897.   
  3898.   For example: GET F "d:\mydir\xxx" will return 2 if the path is found but
  3899.     not the file named XXX, a 3 if the path D:\MYDIR is not found, or a 15
  3900.     if there is no D: drive.  GET F "d:\mydir" will return either 2 or 15
  3901.     since it is not clear whether MYDIR is supposed to be a file or a path.
  3902.     Whenever the item specified in the filespec may not exist, always check
  3903.     for an empty GET variable (IF "%GET%"=="") which indicates that an error
  3904.     code is in the ErrorLevel. 
  3905.   
  3906.   Device Drivers: GET F can be used as a means of communication between your
  3907.     CONFIG.SYS and your AUTOEXEC.BAT.  GET F will take the name of a device
  3908.     driver that may have been loaded in CONFIG.SYS and check to see if it
  3909.     has, in fact been loaded.  The response will be similar to that for a
  3910.     DIR; i.e. if the driver is loaded, 0 in the ErrorLevel and "0" in the
  3911.     Environment.  If the driver is not loaded, the Environment variable will
  3912.     be empty, and the ErrorLevel will contain an error code, usually 2.
  3913.     CAUTION!  The name you use for the driver must be the INTERNAL name, not
  3914.     necessarily the same name you use in CONFIG.SYS.  Most memory mapping
  3915.     commands and programs will show the internal name that you must use.
  3916.     This method will not work for ANSI.SYS and its clones because they use
  3917.     the name CON, but GET A is available to determine whether ANSI.SYS is
  3918.     loaded.  (With all that said, it is only fair to point out that you can
  3919.     accomplish the same effect with IF EXIST by using the internal name of
  3920.     the device driver.  Also, remember that TSR's loaded in AUTOEXEC.BAT are
  3921.     not device drivers and cannot be checked this way.)
  3922.   
  3923.   
  3924.   NOTES: (1) In version 2.5 and earlier GET F /E worked the same as GET F
  3925.  
  3926.  
  3927.  
  3928.  
  3929. GET F                          Get file size                         Page 71
  3930.  
  3931.     /X.  This has been changed and any BATch programs that used GET F /E
  3932.     must be changed to use GET F /X instead to get the exact file size.
  3933.     See additional date format information under GET F /E below 
  3934.   
  3935.     (2) GET F does not open a subdirectory as a file and therefore cannot
  3936.     obtain the date of a subdirectory.  For GET F ... /E, if the filespec is
  3937.     a subdirectory, the ErrorLevel will be 0 and the Environment variable
  3938.     will be empty.  Root directories will probably return the same result,
  3939.     but see information on root directories above.
  3940.   
  3941.     (3) For GET F, /X will still report the full filesize in hex even if the
  3942.     errorlevel is in kilobytes (/A not being used), while /H will report
  3943.     kilobytes in hex unless /A is being used.  Sorry if this is a bit
  3944.     confusing.
  3945.   
  3946.     (4) GET F will also accept the \ as the last character of the filespec
  3947.     if it is a directory.  A trailing \ will be ignored, so it doesn't
  3948.     necessarily specify a directory. For a root directory, the \ is
  3949.     required.
  3950.   
  3951.   EXAMPLES:
  3952.   
  3953.   1. Check to see if the device QEMM is loaded.  The internal name for QEMM
  3954.     is QEMM386$.  In this example, the driver is loaded.
  3955.   
  3956.   Rem Turn on GET reporting feature
  3957.   SET GET?=ON
  3958.   get F QEMM386$
  3959.   Environment: 0
  3960.   ErrorLevel: 0
  3961.   
  3962.   2. Same example, but QEMM is not loaded.
  3963.   
  3964.   get F QEMM386$
  3965.   ErrorLevel: 2
  3966.   
  3967.   3. Check for the existence of a directory named D:\QPRO\WQ1.  IN this
  3968.     example the directory exists.
  3969.   
  3970.   GET F D:\QPRO\WQ1
  3971.   Environment: 0
  3972.   ErrorLevel: 0
  3973.   
  3974.   4. Same example, but the directory does not exist.  The ErrorLevel is
  3975.     reported as 2 meaning "File not found" because it cannot be determined
  3976.     of WQ1 is a file or a subdirectory.
  3977.   
  3978.   GET F D:\QPRO\WQ1
  3979.   ErrorLevel: 2
  3980.   
  3981.   5. Suppose a file named d:\qpro\wq1\taxes.wq1 is a valid file name.  Using
  3982.     GET F to get the file size could produce any of the following results.
  3983.   
  3984.   Rem If you enter an invalid directory:
  3985.   GET F D:\QPRO\WQ\TAXES.WQ1
  3986.   ErrorLevel: 3
  3987.  
  3988.  
  3989.  
  3990.  
  3991. Page 72                          Get file size                         GET F
  3992.  
  3993.   Rem If the file does not exist after all:
  3994.   GET F D:\QPRO\WQ1\TAXES.WQ1
  3995.   ErrorLevel: 2
  3996.   
  3997.   Rem If the file is found to have 23,129 bytes:
  3998.   GET F D:\QPRO\WQ1\TAXES.WQ1
  3999.   Environment: 23
  4000.   ErrorLevel: 23
  4001.   GET F D:\QPRO\WQ1\TAXES.WQ1 /X
  4002.   Environment: 5A59
  4003.   ErrorLevel: 23
  4004.   Rem Turn off GET reporting feature
  4005.   SET GET?=
  4006.   
  4007.   6. Suppose you have a file of exactly 166,816 bytes.  You could see the
  4008.     following results.
  4009.   
  4010.   GET F filespec
  4011.   Environment: 163
  4012.   ErrorLevel: 163
  4013.   
  4014.   GET F filespec /A
  4015.   Environment: 166816
  4016.   ErrorLevel: 255
  4017.   
  4018.   GET F filespec /A /W1000
  4019.   Environment: 166816
  4020.   ErrorLevel: 166
  4021.   
  4022.   GET F filespec /A /W1000 /X
  4023.   Environment: 28BA0
  4024.   ErrorLevel: 166
  4025.   
  4026.   
  4027.   7. Suppose we have a file we want to copy to drive B:, but we want to
  4028.     check if there is enough space for it.  Note that file size is rounded
  4029.     up and disk space is truncated by integer arithmetic so the result here
  4030.     will err on the safe side if at all.  Since GET F reports kilobytes in
  4031.     the ErrorLevel, and GET K reports kilobytes in the Environment, we can
  4032.     test as follows:
  4033.   
  4034.   @echo off
  4035.   Rem First get the disk free space on drive B: and save it in FREE=
  4036.   get k b /VFREE=
  4037.   Rem Check for error
  4038.   if not errorlevel 1 goto error
  4039.   Rem Now get the size of the file and check if there is enough room.
  4040.   get f filename.ext
  4041.   Rem Check for error
  4042.   if "%GET%"=="" goto error
  4043.   Rem If the ErrorLevel is not greater than the free kilobytes goto sizeok.
  4044.   if not errorlevel %FREE% goto sizeok
  4045.   Echo There is insufficient space on Drive B: for filename.ext.
  4046.   goto exit
  4047.   :sizeok
  4048.   copy filename.exe b:
  4049.   goto exit
  4050.  
  4051.  
  4052.  
  4053.  
  4054. GET F                          Get file size                         Page 73
  4055.  
  4056.   :error
  4057.   Echo An error has occurred
  4058.   :exit
  4059.   Rem Clear out the FREE variable
  4060.   SET FREE=
  4061.   
  4062.   8. Use GET to estimate the number of minutes it will take to transfer a
  4063.     file at different transmission speeds.  Since the /Wdiv switch for GET F
  4064.     only affects the ErrorLevel, we can use /R to put the resulting value in
  4065.     the Environment also.  Some preliminary math is used in the 9600 and
  4066.     14400 calculations to reduce the divisor.  To keep it simpler, no
  4067.     adjustments are made if the file is larger than 655360.
  4068.   
  4069.   @echo off
  4070.   if "%1"=="" goto HELP
  4071.   Rem Get file size in bytes, store in SIZE=
  4072.   GET F %1 /VSIZE= /A 
  4073.   if "%SIZE"=="" GOTO NOTFOUND
  4074.   if "%SIZE%"=="*" GOTO TOOBIG
  4075.   echo Minimum transfer time for a file size of %SIZE%
  4076.   GET F %1 /r /w7200 /a
  4077.   echo  at 1200 bps = %GET% minutes
  4078.   GET F %1 /r /w14400 /a
  4079.   echo  at 2400 bps = %GET% minutes
  4080.   Rem Get file size in Kilobytes (*1024)
  4081.   Rem SIZE/1060*60 ≈ SIZE/1024*62
  4082.   GET F %1 /W62 /R
  4083.   echo  at  9600 bps = %GET% minutes
  4084.   Rem SIZE/1650*60 ≈ SIZE/1024*97
  4085.   GET F %1 /W97 /R
  4086.   echo  at 14400 bps = %GET% minutes
  4087.   GOTO END
  4088.   :NOTFOUND
  4089.   Echo File %1 not found. 
  4090.   GOTO HELP
  4091.   :TOOBIG
  4092.   Echo File %1 is too large.  Max size is 655360.
  4093.   :HELP
  4094.   Echo   The argument (%%1) is a file specification
  4095.   Echo   bps = bits per second, cps = characters per second
  4096.   Echo   for 12-2400, we use 10 bits / character (8 + start + stop)
  4097.   Echo   for v.32, we est  8-9 bits / character
  4098.   Echo   therefore
  4099.   Echo      1200 bps = max of  120 cps
  4100.   Echo      2400 bps = max of  240 cps
  4101.   Echo      9600 bps = est of 1000-1100 cps, use est 1060
  4102.   Echo     14400 bps = est of 1600-1700 cps, use est 1650
  4103.   :END
  4104.   SET SIZE=
  4105.   SET GET=
  4106.  
  4107.  
  4108.  
  4109.  
  4110. Page 74                        Get file date                        GET F /E
  4111.  
  4112.   GET F /E                                                     Get file date
  4113.   
  4114.   Syntax: GET F[E] filespec [/switches] /E
  4115.   Input: file specification, optionally including path, but no wildcards.
  4116.   Output: ErrorLevel - F: file date or time value specified by /Wn
  4117.                        FE: current country code
  4118.           Environment - date or time value(s) specified by /Wn
  4119.   Switches:
  4120.          /A include leading 0's.
  4121.          /C Compressed dates (see below)
  4122.          /E required
  4123.          /Sn Overrides country code for date format (See GET H)
  4124.   
  4125.   GET F with the /E switch returns the File DATE and/or TIME information in
  4126.     the same manner as GET H[E].  See the description of GET H for
  4127.     additional date and time format information.
  4128.   
  4129.     The /E switch specifies that GET F return the date/time instead of the
  4130.     file size.  The number n in /Wn uses the same coding as GET H[E] to
  4131.     return the date/time information; i.e. 2=Day of the Month, 4=Month,
  4132.     8=Year, 512=2-digit year, 16=Hour, 32=Minute, and 64=Second. These are
  4133.     the only valid codes. The default is 2 for Day of the month (DOM). In
  4134.     other respects, GET F[E] /E works the same as GET H[E] for reporting the
  4135.     date information, and the format will be the same as for system
  4136.     date/time information as reported by GET H. International
  4137.     date/timeformats have been implemented and the /S and /C switches work
  4138.     as specified for GET H[E].
  4139.   
  4140.   NOTES: (1) In version 2.5 and earlier GET F /E worked the same as GET F
  4141.     /X.  This has been changed and any BATch programs that used GET F /E
  4142.     must be changed to use GET F /X instead to get the exact file size.
  4143.   
  4144.     (2) See additional date format information under GET H, including
  4145.     International date formats, the use of the /S switch to override the
  4146.     date format, and the /C switch to give the date in a Compressed format.
  4147.     
  4148.   COMPRESSED DATES with the /C switch (think C for Compressed)
  4149.   
  4150.     GET H and GET F /E report dates in compressed form with /C.  These dates
  4151.     can be used directly to compare the dates between two files or to
  4152.     compare a file date with today's date.  This date format does not have
  4153.     much visual usefulness because it is not directly readable as a date.
  4154.     It can be used to generate unique file names but the names will not be
  4155.     meaningful to view.
  4156.   
  4157.     To report these dates use the /C switch with either GET H /C or GET F
  4158.     filespec /E/C. Other date or file parameters will be ignored but you can
  4159.     use some of the global switches such as /H to report the output in
  4160.     hexadecimal.  The date format is independent of the Country setting and
  4161.     the /S switch, as well as any coded date parameter.  These are ignored
  4162.     and the date is reported as follows.  The /C switch also overrides the
  4163.     Extended functions of GET HE and GET FE/E.
  4164.   
  4165.     The format used is the DOS native internal file date format.  It uses 16
  4166.     bits as follows:
  4167.  
  4168.  
  4169.  
  4170.  
  4171. GET F                          Get file date                         Page 75
  4172.  
  4173.   
  4174.         BITs  fedcba9  8765  43210
  4175.         Value  Year    Month  Day
  4176.     The year is relative to 1980; e.g., 1995 is 15.  Thus to convert to
  4177.     meaningful numbers it is necessary to first convert to binary format
  4178.     then extract the bit fields manually and convert to numbers.
  4179.   
  4180.     The only meaningful date arithmetic that can be done with these numbers
  4181.     is to find the number of days difference but ONLY if both numbers are
  4182.     within the same month.
  4183.   
  4184.     Examples:
  4185.   
  4186.     1. Compare two file dates.
  4187.   
  4188.        GET F file1 /C/E/VF1=
  4189.        GET F file2 /C/E/VF2=
  4190.        GET R "=" %F1% /W%F2%
  4191.   
  4192.        Note that GET R returns the values
  4193.          0 if F1<F2
  4194.          1 if F1=F2
  4195.          2 if F1>F2
  4196.   
  4197.     2. Compare a file date with today's date.
  4198.   
  4199.        GET H /C /VTODAY=
  4200.        GET F file /C/E/VFDATE=
  4201.        GET R "=" %FDATE% /W%TODAY%
  4202.   
  4203.        Remember that the GET HE 14 function can be used to save today's
  4204.        date, then you can set the system date with the DOS DATE command, 
  4205.        and finally you can reset it from the saved date.  That provides
  4206.        the capability to compare a file date with any selected date.
  4207.   
  4208.     3. Find how many days older than today the file is.
  4209.        The first check is to see if they are in the same month,
  4210.        assuming that the same month is in the current year.
  4211.   
  4212. GET H 4 /VTODAY= GET F %1 /E/W4/VFDATE= if "%TODAY%"=="%FDATE%" goto 
  4213. COMPARE ECHO The months do not compare goto QUIT :COMPARE GET H /C 
  4214. /VTODAY= GET F %1 /C/E/VFDATE= GET R "-" %TODAY% /W%FDATE% Echo The 
  4215. file is %GET% days old :QUIT 
  4216.  
  4217.  
  4218.  
  4219. Page 76                         Get Full Path                         GET FP
  4220.  
  4221.   GET FP                                                       Get Full Path
  4222.   
  4223.   Syntax:  GET FP filespec
  4224.   Input:   A file name optionally qualified with a full or partial path.
  4225.   Output:  The full path leading to that file. GET FP returns the same
  4226.     information as MS-DOS 5.0's TRUENAME command. (GET FP requires DOS 3.0
  4227.     or later).
  4228.   Switches: Global only
  4229.   
  4230.     For a given filespec GET FP returns the full path leading to that file.
  4231.     Letters are converted to uppercase, and forward slashes are converted to
  4232.     backslashes; however, if you use forward slashes you must enclose the
  4233.     filespec in single quotes (e.g. 'filespec').
  4234.   
  4235.     The ErrorLevel is the subdirectory level similar to GET Y.
  4236.   
  4237.     Note that the filespec does not have to exist and this is not a test for
  4238.     existence of a given file.  The full path that is returned will be the
  4239.     one to the filespec as if it did exist.  If a test for existence is
  4240.     required, GET F can be applied to the result of GET FP, or you can use
  4241.     the DOS IF EXIST subcommand. 
  4242.   
  4243.     If the filespec given is the name of a directory, it must end in a
  4244.     backslash (\).  Examples: GET FP C:\DOS\ or GET FP \DOS\.  If no
  4245.     filespec is given, the current directory on the logged drive will be
  4246.     returned.  If just a drive specification is given, the colon (:) is
  4247.     required and the current directory on that drive will be returned.
  4248.   
  4249.     If the given path string is on a JOINed drive, the returned name is the
  4250.     one that would be needed if the driver were not JOINed.  Similarly for a
  4251.     SUBSTed, ASSIGNed, or network drive letter.  The full path on a local
  4252.     drive always starts with the drive letter (d:), those on network drives
  4253.     always start with \\.
  4254.   
  4255.     EXAMPLES:
  4256.   
  4257.     1. Use GET FP to get the full path for a file named TEST.EXE.
  4258.   
  4259.         subst d: c:\util\test
  4260.         GET FP d:\test.exe
  4261.       And the result is
  4262.         C:\UTIL\TEST\TEST.EXE
  4263.   
  4264.     2. Find the current directory on a drive other than the logged 
  4265.        drive.  (The colon is required).
  4266.   
  4267.        GET FP e:
  4268.       And the result is (if the current directory on E: is \CURRENT).
  4269.        E:\CURRENT
  4270.   
  4271.     3. Find the parent directory of the current directory on drive E:
  4272.   
  4273.        GET FP E:..
  4274.       And the result is (if the current directory on E: is \CURRENT).
  4275.        E:\
  4276.       Note that the parent directory of the root directory does not exist so
  4277.     such a result would be no Environment variable and an ErrorLevel of 0.
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285. GET FP                         Get Full Path                         Page 77
  4286.  
  4287.   
  4288.     GET FP requires MS-DOS or PC-DOS 3.0 or above, DR DOS or Novell DOS 6.0
  4289.     or above, or OS/2 version 2.0 or above. It may not be able to determine
  4290.     the true name if you use "nested" JOIN or SUBST commands, or on a
  4291.     network which does not report true names properly.
  4292.  
  4293.  
  4294.  
  4295.  
  4296. Page 78                         Execute Program                        GET X
  4297.  
  4298.   GET X                                                      Execute Program
  4299.   
  4300.   Syntax: GET X "d:\path\program.ext" ' progargs' [/switches]
  4301.   Input:  Program name and arguments
  4302.   Output: ErrorLevel - Return code from program
  4303.           Environment - Return code from program
  4304.   Switches: Global only
  4305.   
  4306.   GET X provides a method of getting the return code (ErrorLevel) from a
  4307.     program into the Environment, and XE provides a way to learn the
  4308.     execution path of GET itself.
  4309.   
  4310.   "program" is the name of the program you want to run.  It must be fully
  4311.     qualified with drive, path, and extension of either .COM or .EXE (no
  4312.     BATch files).  The exceptions are if the program is on the current
  4313.     drive, or in the current directory, in which cases drive and\or
  4314.     directory will default to current.  Do not include any spaces inside the
  4315.     double quotes.  You can use .. for the parent directory of the current
  4316.     subdirectory, and . for the current directory, however the latter is not
  4317.     needed since it will default to the current directory.
  4318.   
  4319.   ' progargs' are the arguments, parameters, and switches for the program
  4320.     you want to run.  Notice the space following the first quote! Many
  4321.     programs require that the first character in the "command tail" be a
  4322.     space, so it is good practice to start the argument string with a space.
  4323.     It is also good practice to enclose the progargs in single quotes;
  4324.     however, if no spaces are included, the quotes are not absolutely
  4325.     necessary.
  4326.   
  4327.   [/switches] are the optional switches for GET, such as /M for the master
  4328.     environment, or /V to designate the variable name.  Any switches for the
  4329.     program must be included in progargs.
  4330.   
  4331.   If GET X is successfull in loading and running the designated program, the
  4332.     ErrorLevel from the program will be in both the Environment and the
  4333.     ErrorLevel when GET terminates.
  4334.   
  4335.   If GET X is not successful, the Environment variable will be empty, and
  4336.     the ErrorLevel will contain a reason for the failure such as:
  4337.          2 File not found - check the file specifications.
  4338.          3 Path not found - check the drive and path information
  4339.          4 Too many open files - increase the FILES= in CONFIG.SYS.
  4340.          5 Access denied - check for proper .COM or .EXE extension
  4341.          8 Not enough memory
  4342.   
  4343.   If GET X is successful but the "child" program terminates abnormally,
  4344.     there will be no Environment variable, and the ErrorLevel will be one of
  4345.     the following:
  4346.          21  Child program was terminated by Ctrl-C or Ctrl-Break.
  4347.          22  Critical device error - e.g. answering "a" to "Abort, 
  4348.              Retry, Fail".
  4349.          23  Child program stayed resident as a TSR.  This should never 
  4350.              happen because you should not load a TSR in this manner.
  4351.  
  4352.  
  4353.  
  4354.  
  4355. GET XE                           GET's Path                          Page 79
  4356.  
  4357.   GET XE                                                          GET's Path
  4358.   
  4359.   Syntax: GET XE [/switches]
  4360.   Input:  none
  4361.   Output: ErrorLevel - ASCII code of the drive
  4362.           Environment - The path from which GET.EXE was executed
  4363.   Switches: Global only
  4364.   
  4365.   GET XE places the eXecution path of GET.EXE in the Environment,including
  4366.     the drive, path, name, and extension of the file and location from which
  4367.     GET is executing.  The ErrorLevel will be the ASCII code of the drive;
  4368.     e.g. 65 for A, 66 for B, etc.  This can be useful on an installation
  4369.     disk to determine the drive from which the installation program is
  4370.     running.  Requires DOS 3+.
  4371.  
  4372.  
  4373.  
  4374.  
  4375. Page 80                       Drive and Directory                      GET Y
  4376.  
  4377.   GET Y                                                  Drive and Directory
  4378.   
  4379.   Syntax: GET Y[E] [drive for Y] [/switches]
  4380.   Input:  optional drive letter for Y, none for YE
  4381.   Output: ErrorLevel - Y: directory level, root=0; YE: current drive, A=0.
  4382.           Environment - directory path (Y) or drive letter (YE).
  4383.   Switches:
  4384.           /X for Boot Drive
  4385.   
  4386.   Y  gets the current directory for the default or a specified drive.  It
  4387.     takes an optional drive letter argument (the : is not necessary) which
  4388.     defaults to the current drive if omitted.  The ErrorLevel reports the
  4389.     directory level - 0 = root directory, 1 for first subdirectory level,
  4390.     etc. Note that DOS maintains a "current directory" for each drive, not
  4391.     just for the logged drive, so it makes sense to inquire about the
  4392.     current directory on a drive other than the logged drive.
  4393.   
  4394.   YE returns the current (or logged) drive.  The drive letter is in the
  4395.     Environment, and the drive number in the ErrorLevel - 0=A, 1=B, etc.
  4396.   
  4397.   BOOT DRIVE:  The /X switch with GET YE reports the Boot drive using
  4398.     the same codes and format as GET YE. This feature may require DOS 4.0
  4399.     or later.
  4400.   
  4401.   EXAMPLES:
  4402.   
  4403.   1. Suppose the following conditions exist - logged drive is C:, current
  4404.     directory on C: is C:\DOS, current directory on D: is D:\QPRO\WQ1, there
  4405.     is no E: drive, a floppy disk with no subdirectories is in B:.  GET
  4406.     commands will report as follows:
  4407.   
  4408.   Rem Turn on GET reporting feature
  4409.   SET GET?=ON
  4410.   GET Y
  4411.   Environment: \DOS
  4412.   ErrorLevel: 1
  4413.   
  4414.   GET Y D
  4415.   Environment: \QPRO\WQ1
  4416.   ErrorLevel: 2
  4417.   
  4418.   Rem Get the current drive and directory, and combine them to make
  4419.   Rem a full path that does not end in a trailing backslash.
  4420.   GET YE /VDIR=
  4421.   Environment: C
  4422.   ErrorLevel: 2
  4423.   GET Y
  4424.   Environment: \DOS
  4425.   ErrorLevel: 1
  4426.   if not ErrorLevel 1 set GET=
  4427.   SET DIR=%DIR%:%GET%
  4428.   
  4429.   GET Y B
  4430.   Environment: \
  4431.   ErrorLevel: 0
  4432.   Note: The root directory is the only case that GET ends the Environment
  4433.   variable with the \ character.  (It is easier to add one than to drop
  4434.  
  4435.  
  4436.  
  4437.  
  4438. GET Y                       Drive and Directory                      Page 81
  4439.  
  4440.   it off.)
  4441.   
  4442.   GET Y E
  4443.   ErrorLevel: 0
  4444.   Turn off GET reporting feature
  4445.   SET GET?=
  4446.   
  4447.   2. You can "and" ErrorLevel checks together to check for a specific value.
  4448.     In this example, use ErrorLevel to see if the current drive is B:.
  4449.   
  4450.   GET YE
  4451.   Rem if it is at least 1 and not 2 or more, 
  4452.   Rem then it is exactly 1 meaning B:.
  4453.   if ErrorLevel 1 if not ErrorLevel 2 goto ISB
  4454.   Echo The current drive is not B:
  4455.   goto exit
  4456.   :ISB
  4457.   Echo The current drive is B:
  4458.   :exit
  4459.  
  4460.  
  4461.  
  4462.  
  4463. Page 82               Get MEMORY and SYSTEM Information              GET 2.7
  4464.  
  4465. GET MEMORY and SYSTEM Information
  4466.  
  4467. The commands BR, P, E, M, D, DV, 4, 7, A, and W obtain information about the
  4468.   operating system and hardware configuration.
  4469.   
  4470.   GET BR                                                  Get/Set Break Flag
  4471.   
  4472.   Syntax: GET BR [New flag] [/switches]
  4473.   Input: optional new flag - 1 = ON, 0 = OFF.
  4474.   Output: ErrorLevel - old break flag
  4475.           Environment - old break flag
  4476.   Switches: Global only
  4477.   
  4478.   GET BR checks and/or sets the DOS BREAK Flag. It works like some of the
  4479.     other get/set commands such as B and V. GET BR will report 1 if the
  4480.     BREAK Flag is ON, or 0 if it is OFF.  In addition, GET BR 1 will turn it
  4481.     on, and GET BR 0 will turn it off.  Although you can control BREAK with
  4482.     the DOS BREAK command, GET BR allows you to store the user setting and
  4483.     temporarily change it to suit your programming style.  Of course, if you
  4484.     allow the user to BREAK out of your BATch file with DOS Ctrl-Break
  4485.     handling, you will not have the opportunity to reset it, but if you want
  4486.     to handle BREAK yourself and use /C regularly, then you can get, set,
  4487.     and restore the user BREAK Flag with GET BR.
  4488.   
  4489.   GET BR also gives you another method of communicating information from
  4490.     your CONFIG.SYS to your AUTOEXEC.BAT.  You can set BREAK ON or OFF in
  4491.     CONFIG.SYS according to whatever you want it to mean, and use GET BR to
  4492.     check and optionally reset it in your AUTOEXEC.BAT, then take some
  4493.     action according to whether it was ON or OFF.
  4494.   
  4495.   EXAMPLES:
  4496.   
  4497.   1. Save user Break flag setting so you can turn it off to help you do your
  4498.     own Ctrl-Break management with the /C switch.  When finished, restore
  4499.     user's original flag setting.
  4500.   
  4501.   Rem set BREAK OFF and save old setting in variable BREAK=.
  4502.   GET BR 0 /VBREAK=
  4503.   Rem Now do whatever you want in the BATch file, such as:
  4504.   GET S "Enter your password: " /c
  4505.   Rem When finished, restore saved Break flag setting.
  4506.   GET BR %BREAK%
  4507.   Rem Don't forget to clear out the variable!
  4508.   SET BREAK=
  4509.   
  4510.   2.  Suppose in one CONFIG.SYS file you have BREAK=ON to indicate that you
  4511.     are configuring for your CAD program, and in another CONFIG.SYS file you
  4512.     have BREAK=OFF if you want to run your normal configuration.  In your
  4513.     AUTOEXEC.BAT you can test the Break flag, set it to the setting you
  4514.     want, and take appropriate action, thus using just one AUTOEXEC for both
  4515.     configurations.
  4516.  
  4517.  
  4518.  
  4519.  
  4520. GET BR                       Get/Set Break Flag                      Page 83
  4521.  
  4522.   
  4523.   Rem Get break flag setting and turn it off.
  4524.   GET BR 0
  4525.   if "%GET%"=="1" goto RUNCAD
  4526.   Rem Do your something else here.
  4527.   goto EXIT
  4528.   :RUNCAD
  4529.   Rem Run your CAD program here.
  4530.   :EXIT
  4531.  
  4532.  
  4533.  
  4534.  
  4535. Page 84                     Check for Printer(PRN)                     GET P
  4536.  
  4537.   GET P                                               Check for printer(PRN)
  4538.   
  4539.   Syntax: GET P[E] "prompt" [/switches]
  4540.   Input: none
  4541.   Output: ErrorLevel - 1=yes, 0=no
  4542.           Environment - 1=yes, 0=no
  4543.   Switches: 
  4544.          /X  Disable PrtSc for GET PE only.
  4545.   
  4546.   P checks whether a printer is available and ready at LPT1 (PRN).  1=yes,
  4547.     0=no.
  4548.   
  4549.     GET P[E] now takes an optional prompt.  Thus you can announce to the
  4550.     user what is happening without a separate Echo; e.g.
  4551.   
  4552.     GET PE "Initializing the printer"
  4553.   
  4554.     The usual ECho switches /N and /A can be used.
  4555.   
  4556.   PE will also send the DOS BIOS initialization signal to the printer as it
  4557.     does during boot-up.  This may not work if a print buffer or spooler is
  4558.     in use unless it can be bypassed.  If your printer has an internal
  4559.     buffer this is a way to flush it.  If PE reports no printer, then the
  4560.     print-screen operation (the Print Screen or Shift PrtSc key) will be
  4561.     disabled to prevent hanging the computer if the PrtSc key is
  4562.     inadvertently pressed.  To enable print-screen again, run GET PE with a
  4563.     printer attached and ready.
  4564.   
  4565.   Customized printer status tests.  GET P[E] will accept a numerical arg
  4566.     representing a byte value.  This value will be "and"ed with the printer
  4567.     status byte, and the result returned in the ErrorLevel and the
  4568.     Environment.  If a numerical arg is present GET PE will not affect the
  4569.     status of PrtSC, but it will still attempt to initialize the printer.
  4570.     Note that if you are using a print spooler or buffer, all bets are off.
  4571.     Everything depends on what is returned in response to Int 17h, Service
  4572.     02.
  4573.      
  4574.     Printer status items that can be tested for.  Sum the values to test for
  4575.     the items desired.
  4576.          Value Hex     Item
  4577.            1    $1   Time-out
  4578.            8    $8   I/O Error
  4579.           16   $10   Printer selected
  4580.           32   $20   Out-of-paper signal
  4581.           64   $40   Acknowledgement from printer
  4582.          128   $80   Printer not busy (0 means busy)
  4583.   
  4584.   For GET PE only, the /X switch will force disabling of PrtSc whether a
  4585.     printer is attached or not.
  4586.       
  4587.   EXAMPLES:
  4588.   
  4589.   1. Check to see if a printer is available.
  4590.   
  4591.   GET P
  4592.   if ErrorLevel 1 goto PRINTIT
  4593.   Echo Can't print, no printer available.
  4594.  
  4595.  
  4596.  
  4597.  
  4598. GET P                     Check for Printer(PRN)                     Page 85
  4599.  
  4600.   goto EXIT
  4601.   :PRINTIT
  4602.   copy filename.ext prn
  4603.   :EXIT
  4604.   
  4605.   2. Initialize printer, clearing the buffer and setting the page setting to
  4606.     Top of Form (TOF).  If no printer is available, the Print Screen
  4607.     function will be turned off.
  4608.   
  4609.   GET PE
  4610.   if ErrorLevel 1 goto PRINTIT
  4611.   Echo Can't print, no printer available.
  4612.   Echo The print screen function has been disabled.
  4613.   goto EXIT
  4614.   :PRINTIT
  4615.   Echo The printer has been initialized, internal buffer cleared.
  4616.   :EXIT
  4617.   
  4618.   3. GET P 255 will return a value representing the sum of the values of all
  4619.     1-bits in the printer status byte.
  4620.   
  4621.   4. GET P 144 will indicate with either 0 or 144 whether the printer is
  4622.     available and ready for data.
  4623.   
  4624.   5. Disable Shift-PrtSc:
  4625.          GET PE /X
  4626.          Enable Shift-PrtSc again but only if the PE test is 1:
  4627.          GET PE
  4628.  
  4629.  
  4630.  
  4631.  
  4632. Page 86                      Get Environment Size                      GET E
  4633.  
  4634.   GET E                                                 Get Environment Size
  4635.   
  4636.   Syntax: GET E[E] [/switches]
  4637.   Input: none
  4638.   Output: ErrorLevel - number of Environment bytes free, EE divides by 10.
  4639.           Environment - number of Environment bytes free
  4640.   Switches:
  4641.          /X Full Environment size
  4642.   
  4643.   E reports the number of bytes of Environment space that are available for
  4644.     use.  If it might be over 255 use EE which divides the number of bytes
  4645.     by 10 for the ErrorLevel only, and can report up to 2550 bytes. Since
  4646.     GET makes extensive use of the Environment, it is always a good idea to
  4647.     use GET E at the beginning of the BATch file to determine whether there
  4648.     are enough bytes available for the use of GET in the BATch file.
  4649.   
  4650.   GET E can also report the full Environment size as an eXtra function with
  4651.     /X.  GET E or GET EE with the /X switch will report the total bytes in
  4652.     the command processors Environment.  If you are running under a
  4653.     secondary command processor, GET E or GET EE with the /M switch will
  4654.     report Environment information for the master Environment.
  4655.   
  4656.      One way to use this information is to be able to enlarge the
  4657.     Environment space available if GET E reports too little to do what you
  4658.     want to do.  For example, suppose you need 100 bytes of Environement
  4659.     free, but GET E tells you there are only 50 bytes available.  You can
  4660.     then find the total size of the Environment, and recursively invoke the
  4661.     command processor with the new size that you will need after finding out
  4662.     how big it was originally.  See example 3 below.
  4663.   
  4664.   GET E will remove the GET or other variable specified with /V for GET E
  4665.     before measuring.  That gives a better measure of how much space is
  4666.     available for GET variables.  To provide for sufficient free environment
  4667.     space in the event the BATch file is being run from a "shell" you can
  4668.     now SET GET=(a large variable) in your AUTOEXEC or before loading the
  4669.     shell (PC Shell, Xtree, etc.), and when GET measures the environment it
  4670.     will clear out the GET variable and give you an accurate reading.
  4671.   
  4672.   EXAMPLES:
  4673.   
  4674.   1. Suppose GET will require at least 15 bytes of Environment space for the
  4675.     variables it will create in your BATch file.  Remember to include the
  4676.     space required by the variable name, the = sign, and a terminating zero
  4677.     byte that is automatically added internally.
  4678.   
  4679.   GET E
  4680.   if ErrorLevel 15 goto CONTINUE
  4681.   Echo Not enough free Environment space to run this BATch file.
  4682.   goto EXIT
  4683.   :CONTINUE
  4684.   Rem Continue with the BATch file
  4685.   :EXIT
  4686.   
  4687.   2. A more primitive method of checking for environment space is to attempt
  4688.     to create a variable then see if it is there.  This may result in the
  4689.     user seeing an "Out of environment space" message.
  4690.  
  4691.  
  4692.  
  4693.  
  4694. GET E                      Get Environment Size                      Page 87
  4695.  
  4696.   Rem Try to create a variable that will use 16 bytes of space.
  4697.   SET TEST=1234567890
  4698.   if "%TEST%"=="1234567890" goto CONTINUE
  4699.   Echo Not enough free Environment space to run this BATch file.
  4700.   goto EXIT
  4701.   :CONTINUE
  4702.   Rem Don't forget to clear out your test variable
  4703.   SET TEST=
  4704.   Rem Continue with the BATch file.
  4705.   :EXIT
  4706.   
  4707.   3. You need 100 bytes of Environment free:
  4708.   
  4709.      GET E
  4710.      Rem First time GET reports ErrorLevel : 50
  4711.      Rem Then the second time through with enough space branch to CONTINUE
  4712.      IF ErrorLevel 100 goto CONTINUE
  4713.      GET E /X
  4714.      Rem Check for error to prevent infinite loop.
  4715.      IF not ErrorLevel 1 GOTO END
  4716.      Rem Add 112 bytes to original Env size. (use a multiple of 16).
  4717.      GET R "+" %GET% /W112
  4718.      Rem Invoke a new command processor with increased Env and run BAT file.
  4719.      %COMSPEC% /E:%GET% /C%0 %1 %2 %3 %4 %5
  4720.      Rem When the secondary command processor terminates, it will have
  4721.      Rem   run this BATch file, so now we must exit.
  4722.      GOTO END
  4723.      :CONTINUE
  4724.      Rem Do your thing here.
  4725.      :END
  4726.  
  4727.  
  4728.  
  4729.  
  4730. Page 88                         Get Memory Free                        GET M
  4731.  
  4732.   GET M                                                      Get Memory Free
  4733.   
  4734.   Syntax: GET M[E] [/switches]
  4735.   Input: none
  4736.   Output: ErrorLevel - number of kilobytes free, ME divides by 10.
  4737.           Environment - number of kilobytes free
  4738.   Switches: Global only
  4739.   
  4740.   M  reports the free memory available in kilobytes.  ME divides by 10.
  4741.   
  4742.   EXAMPLES:
  4743.   
  4744.   1.   A BATch file can check if there is sufficient memory to run a
  4745.     program.
  4746.   
  4747.   GET M
  4748.   if errorlevel 150 goto CONTINUE
  4749.   Echo Not enough memory to run your program.
  4750.   goto EXIT
  4751.   :CONTINUE
  4752.   Rem Run your program here.
  4753.   :EXIT
  4754.   
  4755.   2.  Suppose your program requires 300kb of memory.
  4756.   
  4757.   GET ME
  4758.   if errorlevel 30 goto CONTINUE
  4759.   Echo Not enough memory to run your program.
  4760.   goto EXIT
  4761.   :CONTINUE
  4762.   Rem Run your program here.
  4763.   :EXIT
  4764.  
  4765.  
  4766.  
  4767.  
  4768. GET D                         Get DOS Version                        Page 89
  4769.  
  4770.   GET D                                                      Get DOS Version
  4771.   
  4772.   Syntax: GET D[E] [/switches]
  4773.   Input: none
  4774.   Output: ErrorLevel - First two digits of DOS Version times 10.
  4775.           Environment - Major Version, DE gives Minor Version.
  4776.   Switches: Global only
  4777.   
  4778.   D  reports the DOS version.  The ErrorLevel will contain a number such as
  4779.     33 for DOS 3.3 and 3.31, or 50 for DOS 5.0.  The Environment will
  4780.     contain the major version such as 3 for DOS 3.0, 3.1, 3.3, or 3.3.  DE
  4781.     will report the minor version in the Environment such as 1 for DOS 3.1,
  4782.     31 for DOS 3.31, or 0 for DOS 5.0.  GET D reports 20 (or greater) in the
  4783.     Environment for OS/2 major version.  GET DE will put a 2 digit minor in
  4784.     Environment (but not in ErrorLevel).
  4785.   
  4786.   EXAMPLES:
  4787.   
  4788.   1. You're setting up a program for your clients and it requires something
  4789.     different depending on whether the DOS Version is later than or earlier
  4790.     than 3.1.
  4791.   
  4792.   GET D
  4793.   if ErrorLevel 31 goto DOS3
  4794.   Rem Do what you need here for DOS 2.x or 3.0.
  4795.   goto EXIT
  4796.   :DOS3
  4797.   Rem Do what you need here for DOS 3.1 and later.
  4798.   :EXIT
  4799.   
  4800.   2. You are distributing a program that requires DOS 3.3 or later.
  4801.   
  4802.   GET D
  4803.   if ErrorLevel 33 goto DOSOK
  4804.   Echo This program requires DOS 3.3 or later.
  4805.   goto EXIT
  4806.   :DOSOK
  4807.   Rem Run your program here.
  4808.   :EXIT
  4809.  
  4810.  
  4811.  
  4812.  
  4813. Page 90                        DESQview Version                       GET DV
  4814.  
  4815.   GET DV                                                Get DESQview Version
  4816.   
  4817.   Syntax: GET DV [/switches]
  4818.   Input: none
  4819.   Output: ErrorLevel - First two digits of DV Version times 10.
  4820.           Environment - Major Version
  4821.   Switches: Global only
  4822.   
  4823.   DV reports the DESQview version if DV is running or 0 if not.  The
  4824.     ErrorLevel will contain a number such as 40 for DV 4.0 The Environment
  4825.     will contain the major version such as 4 for DV 4.0, 4.1, etc.
  4826.   
  4827.   EXAMPLE:
  4828.   
  4829.   1. If DESQview is in control do one thing, if not do something else.
  4830.   
  4831.   Rem Find out if DV is running and store the information.
  4832.   GET DV /VDV=
  4833.   if "%DV%"=="0" goto to MSDOS
  4834.   Rem Run your DV dependent commands here.
  4835.   goto EXIT
  4836.   :MSDOS
  4837.   Rem Do something else here.
  4838.   :EXIT
  4839.   Rem Clear out the DV variable
  4840.   SET DV=
  4841.  
  4842.  
  4843.  
  4844.  
  4845. GET 7                        Check Coprocessor                       Page 91
  4846.  
  4847.   GET 7                                                Check Coprocessor/CPU
  4848.   
  4849.   Syntax: GET 7[E] [/switches]
  4850.   Input: none
  4851.   Output: ErrorLevel - 7: Math Coprocessor Installed - 7E: type of CPU.
  4852.           Environment - Character representation of ErrorLevel number.
  4853.   Switches: Global only
  4854.   
  4855.   7  reports whether a math coprocessor is installed.  1=yes, 0=no.
  4856.   
  4857.   7E reports the CPU chip type - 0 for 8088/86, 2 for 80286, or 3 for 80386
  4858.     or later.
  4859.   
  4860.   EXAMPLES:
  4861.   
  4862.   1. Run a faster version of a mathematical program if a coprocessor is
  4863.     installed.
  4864.   
  4865.   GET 7
  4866.   if ErrorLevel 1 goto NDP
  4867.   Rem Run the slower version here
  4868.   goto EXIT
  4869.   :NDP
  4870.   Rem Run the faster version here
  4871.   :EXIT
  4872.   
  4873.   2. Run the 386 version of a program if the CPU is an 80386 or later.
  4874.   
  4875.   GET 7E
  4876.   if ErrorLevel 3 goto IS386
  4877.   Rem Run the non-386 version here
  4878.   goto EXIT
  4879.   :IS386
  4880.   Rem Run the 386 version here
  4881.   :EXIT
  4882.  
  4883.  
  4884.  
  4885.  
  4886. Page 92                       Check 4DOS/Windows                       GET 4
  4887.  
  4888.   GET 4                                                   Check 4DOS/Windows
  4889.   
  4890.   Syntax: GET 4[E] [/switches]
  4891.   Input: none
  4892.   Output: ErrorLevel - 4: 4DOS version number.  4E: Windows.
  4893.           Environment - Character representation of ErrorLevel number.
  4894.   Switches: Global only
  4895.   
  4896.   4 Checks whether 4DOS or [4E] Windows is currently running and returns the
  4897.     4DOS version number. The ErrorLevel will contain a number such as 40 for
  4898.     4DOS 4.0.  The Environment will contain the major version such as 4 for
  4899.     4DOS 4.0, 4.1, etc.  4E will report the minor version in the Environment
  4900.     such as 1 for 4DOS 4.1 or 0 for 4DOS 5.0.
  4901.   
  4902.   The 4DOS Version number only indicates that 4DOS is in memory, not
  4903.     necessarily that it is the parent of the BATch program, but you can
  4904.     check for that with the test given in the 4DOS manual: 
  4905.       if not "%_cwd%"=="" echo 4DOS is loaded!
  4906.   
  4907.   Although 4DOS provides a method to make this check directly with BATch
  4908.     commands, it may be a convenience to use GET to obtain and store the
  4909.     information in the same command.  4DOS provides a lot of services for
  4910.     BATch files, and some DOS-like commands have extra features, but if the
  4911.     BATch file might be run on a system that is not using 4DOS for the
  4912.     command processor those extra features can't be used.
  4913.   
  4914.   4E returns 1 if Windows is running or 0 if not.  Some DOS commands, such
  4915.     as CHKDSK, must not be run if Windows is running.  You can use the GET
  4916.     4E command to avoid these problems.
  4917.   
  4918.   EXAMPLES:
  4919.   
  4920.   1. If 4DOS is the command processor, use some of its special features.  If
  4921.     not, make do the best you can with COMMAND.COM and GET.
  4922.   
  4923.   Rem Find out if 4DOS is running and store the information.
  4924.   GET 4 /V4DOS=
  4925.   if "%4DOS%"=="0" goto to MSDOS
  4926.   Rem Run your 4DOS enhanced commands here.
  4927.   goto EXIT
  4928.   :MSDOS
  4929.   Rem Do the best you can with MS DOS with GET here.
  4930.   :EXIT
  4931.   Rem Clear out the 4DOS variable
  4932.   SET 4DOS=
  4933.   
  4934.   2. Make a cover for CHKDSK to avoid damaging your disk if Windows is
  4935.     running.  Since CHKDSK is an external command, you can rename it to
  4936.     something else to avoid running it inadvertently.  Suppose we rename it
  4937.     CHEKDISK.EXE and call this BATch file CHKDSK.BAT.
  4938.   
  4939.   @Echo off
  4940.   Rem This file is CHKDSK.BAT, a cover for DOS CHKDSK.
  4941.   get 4E
  4942.   if ErrorLevel 1 goto WINDOWS
  4943.   CHEKDISK %1 %2 %3
  4944.   goto EXIT
  4945.  
  4946.  
  4947.  
  4948.  
  4949. GET 4                       Check 4DOS/Windows                       Page 93
  4950.  
  4951.   :WINDOWS
  4952.   Echo Don't run CHKDSK when WINDOWS is running!
  4953.   :EXIT
  4954.  
  4955.  
  4956.  
  4957.  
  4958. Page 94                    Check for ANSI.SYS/Model                    GET A
  4959.  
  4960.   GET A                                             Check for ANSI.SYS/Model
  4961.   
  4962.   Syntax: GET A[E] [/switches]
  4963.   Input: none
  4964.   Output: ErrorLevel - A: ANSI.SYS - AE: ROM BIOS Model Byte/BIOS Date
  4965.           Environment - A: 1=yes, 0=no - AE: Hexadecimal Model Byte/Date
  4966.   Switches: Global only
  4967.   
  4968.   A  reports whether ANSI.SYS is loaded.  If you are using an ANSI.SYS
  4969.     clone, check to see if it works with yours.
  4970.   
  4971.   AE will return the ROM BIOS model byte (a 2-character machine code)
  4972.     followed by a space, then the 8-byte BIOS date. At this time the
  4973.     documented model bytes listed in "The NEW Peter Norton's Programmer's
  4974.     Guide to the IBM PC and PS/2," (Page 64) are:
  4975.   
  4976.      FF(255)=PC(1981)    
  4977.      FE(254)=PC or PC/XT(1982)    
  4978.      FD(253)=PCjr(1983)
  4979.      FC(252)=PC/AT(1984-85),PC/XT Model 286(1986),PS/2 Model 50/60(1987)
  4980.      FB(251)=PC/XT(1986)      
  4981.      FA(250)=PS/2 Model 25(1987)/30(1986)
  4982.      F9(249)=PC Convertible   
  4983.      F8(248)=PS/2 Model 80(1987)
  4984.      (Example: An 80386 AT clone is an FC, ErrorLevel 252).
  4985.   
  4986.   EXAMPLES:
  4987.   
  4988.   1.  If the computer is running ANSI.SYS you can use it to provide special
  4989.     screen effects.  For example, 4DOS has commands that take advantage of
  4990.     the features of ANSI.SYS that won't work if ANSI.SYS isn't loaded.
  4991.   
  4992.   Rem Check for ANSI.SYS and store the result in ANSI=
  4993.   GET A /VANSI=
  4994.   
  4995.   2.  If you are supporting several computers and they are different models,
  4996.     you may be able to determine which one is running the BATch file by
  4997.     reading the model byte.
  4998.   
  4999.   GET AE
  5000.   if ErrorLevel 254 goto NOSUPP
  5001.   if ErrorLevel 253 goto PCJR
  5002.   if ErrorLevel 252 goto ATCLONE
  5003.   if ErrorLevel 249 if not ErrorLevel 250 goto CONVERT
  5004.   :NOSUPP
  5005.   Echo This computer is not supported
  5006.   goto EXIT
  5007.   :ATCLONE
  5008.   Rem Do things for AT Clone here
  5009.   goto EXIT
  5010.   :CONVERT
  5011.   Rem Do things for IBM Convertible here
  5012.   goto EXIT
  5013.   :PCJR
  5014.   Rem Do things for the PC Jr. here
  5015.   :EXIT
  5016.  
  5017.  
  5018.  
  5019.  
  5020. GET W                         Warm/Cold Boot                         Page 95
  5021.  
  5022.   
  5023.   GET W                                                       Warm/Cold Boot
  5024.   
  5025.   Syntax: GET W[E] "prompt" [arg] [/switches]
  5026.   Input: any argument to just report type of last boot.
  5027.   Output: ErrorLevel - If arg, 1=warm, 0=cold
  5028.           Environment - If arg, 1=warm, 0=cold
  5029.   Switches:
  5030.        The usual ECho switches /N and /A if a prompt is specified.
  5031.   
  5032.   W  will reboot the computer as if the 3-finger salute (Ctrl-Alt-Del) was
  5033.     pressed unless an arg is given.
  5034.   
  5035.   WE will reboot as if the computer was turned off then on again unless an
  5036.     argument is given.
  5037.   
  5038.   If any characters are present as an argument with W or WE, GET will
  5039.     attempt to determine if the preceding boot was warm or cold instead of
  5040.     rebooting.  This does not work on all machines.  It depends on whether
  5041.     the booting procedure clears a certain memory location - it worked on my
  5042.     XT but not on my 386, for example.  If successful, a 1 indicates the
  5043.     previous boot was warm, 0 means it was a cold boot.
  5044.   
  5045.   GET W will take a prompt.  If a "prompt" is specified, GET C is called
  5046.     internally to wait for a character to be entered.  The switches for GET
  5047.     C including /W, /C, and /A can be used.  If /C is not specified the user
  5048.     can break out with Ctrl-Break or Ctrl-C.  To prevent this, use /C.  When
  5049.     a valid character is entered, the specified type of reboot will be
  5050.     initiated.  Using a prompt nullifies the effect of an argument which
  5051.     modifies GET W to just try to determine whether the last boot was warm
  5052.     or cold.  As with GET C, if an invalid character is entered, the waiting
  5053.     time will be infinite.
  5054.   
  5055.   EXAMPLES
  5056.   
  5057.   1. Copy in a new AUTOEXEC.BAT and CONFIG.SYS and warm boot.
  5058.   
  5059.   copy autoexec.new autoexec.bat
  5060.   copy config.new config.sys
  5061.   get w
  5062.   
  5063.   2. Ask for a password, if it is wrong cold boot the computer.
  5064.   
  5065.   get S "Enter password now: " TTTTTTTT
  5066.   if "%GET%"=="PASSWORD" goto OK
  5067.   get we
  5068.   OK:
  5069.   Rem Password was correct, continue.
  5070.   
  5071.   3. Perform a CHKDSK if a cold boot but not a warm boot - may only work on
  5072.     XT class machines.
  5073.   
  5074.   GET W xxx
  5075.   if ErrorLevel 1 CHKDSK
  5076.  
  5077.  
  5078.  
  5079.  
  5080. Page 96                  The Environment and Shells                  GET 2.7
  5081.  
  5082. The Environment and Shells
  5083.  
  5084. This is a brief, general discussion of the DOS Environment for those who may
  5085.   not be sufficiently familiar with it.
  5086.  
  5087.    The DOS Environment is a small area (usually) of memory that DOS
  5088.   automatically allocates to every program that it is asked to load or run.
  5089.   The "master" Environment is the original Environment allocated to
  5090.   COMMAND.COM or 4DOS or whichever command processor you are using.  The
  5091.   original size of the Environment can be set in later versions of DOS by
  5092.   using the SHELL command in your CONFIG.SYS file.  However, the setting of
  5093.   Environment size is not a SHELL command function, but is a command
  5094.   processor option.  For example, the COMMAND.COM /E: switch lets you set
  5095.   the size if you are using COMMAND.COM as your command processor.  For
  5096.   documentation look under such topics as SHELL, COMMAND, and "Configuring
  5097.   Your System" in your DOS manual.  Since most new programs make extensive
  5098.   use of the Environment, it is important to be sure enough Environment
  5099.   space is allocated to accommodate them all.  If you see the error message
  5100.   "Out of Environment Space", you know that you do not have enough
  5101.   allocated.
  5102.  
  5103.    You can view the contents of the Environment by issuing the SET command
  5104.   of DOS with no arguments at the DOS prompt.  You will see a sequence of
  5105.   variable names, each followed by the "=" sign and the string value
  5106.   assigned to the variable.  For example, COMSPEC=C:\COMMAND.COM.  You can
  5107.   also store string information in the Environment with the SET command by
  5108.   specifying it in the same manner as it is displayed.  For example, SET
  5109.   PATH=C:\;C:\DOS.  Do not place any spaces on either side of the "=" sign
  5110.   unless you intend for the space to be either a part of the variable name
  5111.   or a part of the string.  When DOS loads and runs a COM or EXE program
  5112.   file, that program receives a copy of the Environment as it is at that
  5113.   time, trimmed down so that only a few bytes remain free.  This copy does
  5114.   not change unless the program that owns it changes it.
  5115.  
  5116.    While COMMAND.COM and 4DOS are true shells, many users run programs from
  5117.   within other programs also known as "shells".  These include programs such
  5118.   as PC Shell from Central Point's PC Tools, The Norton Commander, Xtree,
  5119.   and many others.  Note that these DOS "shells" shield the master
  5120.   Environment from programs that are executed by the shell. If you find that
  5121.   to be the case, the information will usually be available to the BATch
  5122.   file from the Environment of the secondary command processor loaded by the
  5123.   shell as is usually necessary to run a BATch file.  Except for the /M
  5124.   switch, GET only attempts to locate the Environment of the command
  5125.   processor that is running the BATch file, so the Environment information
  5126.   can disappear if the shell or the secondary command processor is
  5127.   terminated.  GET attempts to place the information where the BATch file
  5128.   can locate it since that is its primary purpose.
  5129.  
  5130. Out of Environment Space
  5131.  
  5132.    When running a BATch file from a "shell" there may be problems with "Out
  5133.   of Environment space" since DOS does not usually allocate excess
  5134.   Environment space to child processes.  4DOS and its alter-ego NDOS provide
  5135.   a means to ensure that copies of the Environment have sufficient space
  5136.   available, but COMMAND.COM is very stingy with the amount of free
  5137.   Environment space it allocates to child processes.  Check the
  5138.   documentation for your shell program to see if it can make sufficient
  5139.  
  5140.  
  5141.  
  5142.  
  5143. GET 2.7                  The Environment and Shells                  Page 97
  5144.  
  5145.   Environment space available.  If you plan on running a BATch file from a
  5146.   shell and find that "Out of environment space" is a problem, there are
  5147.   several things that you can try to do.
  5148.  
  5149.   If COMMAND.COM is your command processor, in order to run your.bat you can
  5150.   tell your shell to use the command, C:\COMMAND.COM /E:512 /Cyour.bat.
  5151.   Assuming that COMMAND.COM is in the root directory of the C: drive, this
  5152.   will allocate 512 bytes of Environment space to your BATch file.  Just
  5153.   adjust the command for the proper location of your COMMAND.COM and the
  5154.   actual amount of Environment space you will need with the /E: switch.
  5155.  
  5156.   If your shell won't cooperate in running COMMAND.COM in this manner, then
  5157.   you can establish a BATch file to do it for you.  Call it RUNBATCH.BAT and
  5158.   make the first line %COMSPEC% /E:512 /C%1 %2 %3 etc.  Then when you want
  5159.   to run your.bat, tell your shell to execute the command RUNBATCH your.bat.
  5160.   Follow that with any parameters you need for your.bat and they will be
  5161.   picked up by the %1 %2 %3 etc. replaceable parameters in RUNBATCH.BAT.
  5162.  
  5163.   Another method to ensure that GET has enough Environment space to store
  5164.   its results is to establish a dummy GET variable before loading any shells
  5165.   or other programs.  The best way would be to do it in your AUTOEXEC.BAT.
  5166.   Simply insert the command SET GET=xxxxx...xxxx in your AUTOEXEC.BAT file
  5167.   with enough x's or other characters for the maximum length input string
  5168.   you are expecting.  Then in any BATch file that is to be run from the
  5169.   shell, before using GET issue the command SET GET=.  This will remove the
  5170.   GET variable from the Environment and free the space to be reused by GET.
  5171.  
  5172.   One recurring reason for this problem is running the BATch file from a so-
  5173.   called "shell" - Windows, PC Shell, Norton Commander, Xtree, etc.. When
  5174.   you run a BATch file from a shell, it invokes a second copy of COMMAND.COM
  5175.   (a true shell), but DOS is stingy with the environment space it passes to
  5176.   a "child" program such as this second copy of COMMAND.COM.  There are a
  5177.   couple of solutions - if this is, in fact, the problem.
  5178.  
  5179.   1.  If you can get your shell to run your BATch file with the command
  5180.   C:\COMMAND.COM /E:1024 /Cyourbat then you can specify how much environment
  5181.   space you want with the /E:nnn parameter.  Of course put in the real name
  5182.   and location of your command processor where I have put C:\COMMAND.COM.
  5183.  
  5184.   2.  In your autoexec set a large dummy variable in your Environment with
  5185.   the SET command, such as SET DUMMY=a large variable here but make it
  5186.   longer.  Then when you run a BATch file from a shell, make the first
  5187.   statement in the BATch file SET DUMMY= and it will clear up the space for
  5188.   use by GET.
  5189.  
  5190.   3. Use 4DOS or NDOS for your command processor instead of COMMAND.COM.
  5191.   4DOS and its alter-ego NDOS allow you to specify how much free environment
  5192.   space you want for child processes.  Only 4DOS does it the way it should
  5193.   be done.  MS never has handled the Environment space problem very well.
  5194.  
  5195.   4.  See examples for GET E showing how to run your BATch file recursively
  5196.   by invoking a secondary command processor yourself.
  5197.  
  5198.  
  5199.  
  5200.  
  5201. Page 98                      Program Information                     GET 2.7
  5202.  
  5203. PROGRAM INFORMATION
  5204.  
  5205.   GET is programmed in assembly language for MS-DOS computers. It was
  5206.   assembled with Borland's Turbo Assembler, and compressed with a file
  5207.   compression utility. GET is designed to be small and fast to provide rapid
  5208.   response in BATch files and not take up too much room on floppy disks,
  5209.   consequently it does not do extensive error checking.  Nothing in GET is
  5210.   known to cause harm, but if parameters are not used in accordance with the
  5211.   documentation the results may not be what you expect.  GET is designed for
  5212.   productive use by BATch programmers, not for casual use from the keyboard.
  5213.  
  5214.   In most applications there will be no noticeable slowing down of BATch
  5215.   file execution due to the use of GET.  Most versions of DOS read and
  5216.   execute lines of BATch files one at a time.  This is the slowest part of
  5217.   the BATch execution process.  Providing there are sufficient DOS buffers
  5218.   or a disk cache, GET will remain available in the buffers or cache in
  5219.   memory and execute instantaneously when loaded by DOS.  Some additional
  5220.   speedup may be noticed if it is possible to locate GET.EXE and/or your
  5221.   BATch file on a virtual disk in RAM such as on a RAMDRIVE or VDISK.
  5222.  
  5223.   RUNTIME Version for Registered users
  5224.   ---------------------------------------------------------------
  5225.   Registered users of GET receive a registered RUNTIME module that is
  5226.   smaller and may provide additional speed in execution.  It is not burdened
  5227.   with the over 2K of Help screens so may load slightly faster when invoked.
  5228.   The registered runtime version does not display the copyright notice
  5229.   unless it is called with no valid arguments, and is under 6K in size.
  5230.  
  5231.   For the convenience of registered users who are developing BATch files,
  5232.   and want to use the runtime module for development to avoid the periodic
  5233.   display of the copyright notice, the GET?=ON feature has been added to the
  5234.   runtime module.  With GET?=ON either GET module will report the values
  5235.   that it places in the Environment and the ErrorLevel for debugging
  5236.   purposes.
  5237.  
  5238.   If you do use the runtime module as suggested, yet you like to have the
  5239.   help screens from the shareware module available for use, I suggest using
  5240.   one of the following methods:
  5241.  
  5242.   (a) Use redirection to capture the help screens to a file and use a text
  5243.   editor or file viewer to read the file. It is very useful to load this
  5244.   file into a window in your text editor when you are editing BATch files
  5245.   for quick reference.
  5246.  
  5247.   (b) Keep GET27.EXE in your path and run it when you want to view the help
  5248.   screens.
  5249.  
  5250. LICENSING AND DISTRIBUTION
  5251.  
  5252.   If you like GET and would like to help support development of inexpensive
  5253.   software, please send a contribution to the address below.  Thank you for
  5254.   any support you care to provide.  If you send $15 or more (plus
  5255.   appropriate shipping and tax) you will receive the following benefits:
  5256.  
  5257.     The latest version of GET with any new features.
  5258.     A smaller runtime version to distribute with your BATch files.
  5259.     A single user license with no royalties for use of the runtime version.
  5260.  
  5261.  
  5262.  
  5263.  
  5264. GET 2.7                      Program Information                     Page 99
  5265.  
  5266.     Optional purchase of a printed copy of this manual.
  5267.     Free support by BBS, mail, phone, or CompuServe (see below).
  5268.     Notification of new releases and upgrades.
  5269.     Reduced prices for upgrades.
  5270.  
  5271.   See ORDER.GET for pricing information.  California residents please add
  5272.   applicable sales tax.  See the SPECIAL OFFER below for a discount on
  5273.   registering both GET and MASDIR.
  5274.  
  5275.   If you have a modem, VISA and MASTERCARD registrations can be entered via
  5276.   NITELOG BBS, 408-655-1096.  After completing the brief sign-on
  5277.   registration, enter S for Script, then 3 for Script 3 and provide the
  5278.   requested information.
  5279.  
  5280.   CORPORATE users must obtain a site license from me for in-house use. See
  5281.   the file ORDER.GET for pricing and ordering information.   None of the
  5282.   above licensing terms includes using GET in conjunction with the
  5283.   distribution of a commercial (retail) software product other than
  5284.   shareware, user-supported, or public domain software. To use GET in
  5285.   conjunction with the distribution of a retail software product you must
  5286.   obtain either a site license or a distribution license.  Call or message
  5287.   for quotes if you are interested or have any questions.
  5288.  
  5289.   BBS SYSOPs, PC User Groups, and shareware authors and distributors are
  5290.   hereby granted a single user license to use GET for their own purposes. If
  5291.   such persons are registered users of GET they may freely distribute
  5292.   unmodified copies of this version of GET.EXE and all of the associated
  5293.   files in GET27.ZIP.  If an unregistered version of GET is used in
  5294.   conjunction with the distribution of a shareware or public domain software
  5295.   product, the distribution disk must include GET27.ZIP.
  5296.  
  5297.   VENDORS who already have my permission to distribute my shareware products
  5298.   have permission to distribute GET.  Other vendors must contact me for
  5299.   permission by sending me a request accompanied with a current catalog or
  5300.   other list of offerings.
  5301.  
  5302.   REGISTERED users of GET may use and distribute GET in accordance with
  5303.   these rules.  GETRUN.EXE is a runtime version of GET available only to
  5304.   registered users.  It omits the online help screens so is considerably
  5305.   smaller and runs in less memory.  GET is not a TSR so the memory is in use
  5306.   only while GET is actually running. 
  5307.  
  5308.   1. GET.EXE may be freely distributed provided the distribution disk
  5309.   includes all *.DOC and other GET distribution files.  Such distribution
  5310.   must not include GETRUN.EXE under any name.
  5311.  
  5312.   2. If you are a licensed user of GETRUN.EXE, up to the licensed number of
  5313.   copies of GETRUN.EXE may be renamed GET.EXE and used in conjunction with
  5314.   distributed BATch files, provided that none of the .DOC files are included
  5315.   on any disk in the distribution package.  For non-commercial use, licensed
  5316.   users may use an unlimited number of copies.  Other registered users may
  5317.   obtain an inexpensive distribution license in addition to a site or single
  5318.   user license.
  5319.  
  5320.   3. GET.EXE and the .DOC files must never be included in any distribution
  5321.   that includes GETRUN.EXE no matter what names are used for these files.
  5322.  
  5323.  
  5324.  
  5325.  
  5326. Page 100             MASDIR, The MASter DIRectory System             GET 2.7
  5327.  
  5328. SPECIAL OFFER
  5329.  
  5330.   If you like GET please try MASDIR!  MASDIR (pronounced 'master') the
  5331.   MASter DIRectory System, is a general purpose sorted directory program
  5332.   with unique customization and disk label printing features. 
  5333.  
  5334.   If you ever use DIR, you should do yourself a favor and take a look at
  5335.   MASDIR! MASDIR is not a "shell".  The main program, SDL.COM, is one of the
  5336.   best sorted directory programs anywhere. The setup program allows you to
  5337.   set the many defaults to your own specifications, including customizing
  5338.   the titles that appear in the header. In addition, you can print disk
  5339.   labels and/or sleeve inserts for 5.25" and 3.5" diskettes. This really
  5340.   saves you a lot of time when you are looking through your collection of
  5341.   diskettes for a particular file. They are all listed conveniently along
  5342.   with your own description in the title lines. You can also create disk
  5343.   file catalogs of your diskettes and directories that you can then annotate
  5344.   to describe individual files, and search with your editor or listing
  5345.   program.
  5346.  
  5347.   Additional features include listing only subdirectories or not listing
  5348.   them at all, listing only files created today or within a specified
  5349.   period, reverse sorting for any of the sort options, the amount of space a
  5350.   group of files will occupy for different cluster sizes, support for DR DOS
  5351.   and 4DOS, SETting defaults in the Environment, enter two file
  5352.   specifications such as *.COM *.EXE, paging up and down in large
  5353.   directories, show only files that have not been backed up (archive bit
  5354.   set), and many more.
  5355.  
  5356.   As of the above date, the current release of MASDIR is Version 5.4. It is
  5357.   a shareware program that is available on bulletin boards, GENIE,
  5358.   CompuServe, The Public (software) Library, PC-SIG, and from other
  5359.   distributors of public domain and shareware programs. If you cannot
  5360.   conveniently locate a copy, I will be happy to send you one. Just contact
  5361.   me as indicated above. The registration fee for MASDIR is $19 including
  5362.   shipping and handling for the program, plus one unit of labels free.
  5363.   Please include $2 S&H only if you order any amount of labels.
  5364.  
  5365.   Register both GET and MASDIR and take a 15% discount.  Use the order form
  5366.   and indicate that you want both MASDIR and GET for just $25, instead of
  5367.   $30.  Then complete the rest of the form for any other items you want.
  5368.  
  5369.   Thank you for your kind attention.
  5370.  
  5371.   Questions, comments, and suggestions are always welcome. Contact us at:
  5372.       MOBY DISK: 1021 San Carlos Road, Pebble Beach, CA 93953
  5373.   Phone: (408) 646-1899  COMPUSERVE:72357,2276  America Online: MobyDisk2
  5374.   Internet: bob.stephan@nitelog.com             BBS: Nitelog 408-655-1096
  5375.   BBS: The Cricket 408-373-3773       /s/ Bob Stephan        May 29, 1995
  5376.  
  5377.  Page A                    ASCII and Scan Codes                  Appendix A
  5378.                                       
  5379.                       Keyboard Codes Recognized by GET
  5380. ┌────────────────────────────────────┬──────────────────────────────────────┐
  5381. │      Function Key Scan Codes(1)    │    Alphabetic & Other ASCII Keys     │
  5382. │Key  Normal   Shift Control    Alt  │ Key/  Normal   Shift  Control  Alt(1)│
  5383. │F1      59      84      94     104  │ Shift  ASCII   ASCII   ASCII     Scan│
  5384. │F2      60      85      95     105  │  Tab       9      15     148(s)   165│
  5385. │F3      61      86      96     106  │   a       97      65       1       30│
  5386. │F4      62      87      97     107  │   b       98      66       2       48│
  5387. │F5      63      88      98     108  │   c       99      67       3       46│
  5388. │F6      64      89      99     109  │   d      100      68       4       32│
  5389. │F7      65      90     100     110  │   e      101      69       5       18│
  5390. │F8      66      91     101     111  │   f      102      70       6       33│
  5391. │F9      67      92     102     112  │   g      103      71       7       34│
  5392. │F10     68      93     103     113  │   h      104      72       8       35│
  5393. │F11    133     135     137     139  │   i      105      73       9       23│
  5394. │F12    134     136     138     140  │   j      106      74      10       36│
  5395. ├────────────────────────────────────┤   k      107      75      11       37│
  5396. │      Number & Top Row Keys         │   l      108      76      12       38│
  5397. │Key/  Normal   Shift  Control Alt(1)│   m      109      77      13       50│
  5398. │Shift  ASCII   ASCII   ASCII   Scan │   n      110      78      14       49│
  5399. │ `/~    96     126      -       41  │   o      111      79      15       24│
  5400. │ 1/!    49      33      -      120  │   p      112      80      16       25│
  5401. │ 2/@    50      64      3(s)   121  │   q      113      81      17       16│
  5402. │ 3/#    51      35      -      122  │   r      114      82      18       19│
  5403. │ 4/$    52      36      -      123  │   s      115      83      19       31│
  5404. │ 5/%    53      37      -      124  │   t      116      84      20       20│
  5405. │ 6/^    54      94      30     125  │   u      117      85      21       22│
  5406. │ 7/&    55      38      -      126  │   v      118      86      22       47│
  5407. │ 8/*    56      42      -      127  │   w      119      87      23       17│
  5408. │ 9/(    57      40      -      128  │   x      120      88      24       45│
  5409. │ 0/)    48      41      -      129  │   y      121      89      25       21│
  5410. │ -/_    45      95      31     130  │   z      122      90      26       44│
  5411. │ =/+    61      43      -      131  │  [/{     123      91      27       26│
  5412. │ \/|    92     124      28      43  │  ]/}     125      93      29       27│
  5413. │BkSp     8       8     127      14  │  ;/:      59      58       -       39│
  5414. ├────────────────────────────────────┤  '/"      39      34       -       40│
  5415. │    Cursor Pad & Grey Key Codes     │  ,/<      44      60       -       51│
  5416. │Key   Normal   Shift  Control Alt(1)│  ./>      46      62       -       52│
  5417. │PrtSc      -      -      114      - │  //?      47      63       -       53│
  5418. │Insert     -      -       -     162 ├──────────────────────────────────────┤
  5419. │Home       -      -       -     151 │    Number Pad (NumLock On(2)) Codes  │
  5420. │PageUp     -      -       -     153 │ Key Normal(2) Shift(2) Control Alt(3)│
  5421. │Delete     -      -       -     163 │ 0/Ins     48      82      146  AltNum│
  5422. │End        -      -       -     159 │ 1/End     49      79      117  AltNum│
  5423. │PageDown   -      -       -     161 │ 2/Down    50      80      145  AltNum│
  5424. │UpArrow    -      -       -     152 │ 3/PgDn    51      81      118  AltNum│
  5425. │LeftArrow  -      -       -     155 │ 4/Left    52      75      115  AltNum│
  5426. │DownArrow  -      -       -     160 │ 5         53      76      143  AltNum│
  5427. │RightArrow -      -       -     157 │ 6/Right   54      77      116  AltNum│
  5428. │ /        47(a)  47(a)  149     164 │ 7/Home    55      71      119  AltNum│
  5429. │ *        42(a)  42(a)  150      55 │ 8/Up      56      72      141  AltNum│
  5430. │ -        45(a)  45(a)  142      74 │ 9/PgUp    57      73      132  AltNum│
  5431. │ +        43(a)  43(a)  144      78 │ ./Del     46      83      147  AltNum│
  5432. │NumEnter 125(4) 125(4)  10(a)   166 │--------------------------------------│
  5433. │Esc      126(4) 126(4) 126(4)     1 │(2)With NumLock Off swap Normal/Shift.│
  5434. │Enter    125(4) 125(4)  10(a)    28 │(3)AltNum keys enter ASCII characters.│
  5435. └────────────────────────────────────┴──────────────────────────────────────┘
  5436. (s) indicates scan code, (a) indicates ASCII code where not readily apparent.
  5437. (1)To use extended/enhanced keys with GET C and GET T, add 100 to the scan code.
  5438. Scan codes of 28 through 150 are reported as surrogates 128 through 250.
  5439. To use extended and enhanced keys with GET U, add 255 to the scan code. Many of
  5440. the scan codes 28 through 150 are recognized as surrogates 283 through 405.
  5441. (4)Surrogate values for use with GET C and GET T.  Also, space will return 255.
  5442.                               ASCII Table
  5443. ┌───────────────────┬────────────┬───────────┬────────────┬────────────┐
  5444. │ Dec   Char   Code │  Dec  Char │ Dec  Char │  Dec  Char │  Dec  Char │
  5445. ├───────────────────┼────────────┼───────────┼────────────┼────────────┤
  5446. │   0   NUL         │   32 Space │  64    @  │   96    `  │  128    Ç  │
  5447. │   1   Ctrl-a      │   33    !  │  65    A  │   97    a  │  129    ü  │
  5448. │   2   Ctrl-b      │   34    "  │  66    B  │   98    b  │  130    é  │
  5449. │   3   Ctrl-c      │   35    #  │  67    C  │   99    c  │  131    â  │
  5450. │   4   Ctrl-d      │   36    $  │  68    D  │  100    d  │  132    ä  │
  5451. │   5   Ctrl-e      │   37    %  │  69    E  │  101    e  │  133    à  │
  5452. │   6   Ctrl-f      │   38    &  │  70    F  │  102    f  │  134    å  │
  5453. │   7   Ctrl-g Bell │   39    '  │  71    G  │  103    g  │  135    ç  │
  5454. │   8   Ctrl-h BkSp │   40    (  │  72    H  │  104    h  │  136    ê  │
  5455. │   9   Ctrl-i Tab  │   41    )  │  73    I  │  105    i  │  137    ë  │
  5456. │  10   Ctrl-j LF   │   42    *  │  74    J  │  106    j  │  138    è  │
  5457. │  11   Ctrl-k      │   43    +  │  75    K  │  107    k  │  139    ï  │
  5458. │  12   Ctrl-l FF   │   44    ,  │  76    L  │  108    l  │  140    î  │
  5459. │  13   Ctrl-m CR   │   45    -  │  77    M  │  109    m  │  141    ì  │
  5460. │  14   Ctrl-n      │   46    .  │  78    N  │  110    n  │  142    Ä  │
  5461. │  15   Ctrl-o      │   47    /  │  79    O  │  111    o  │  143    Å  │
  5462. │  16   Ctrl-p      │   48    0  │  80    P  │  112    p  │  144    É  │
  5463. │  17   Ctrl-q      │   49    1  │  81    Q  │  113    q  │  145    æ  │
  5464. │  18   Ctrl-r      │   50    2  │  82    R  │  114    r  │  146    Æ  │
  5465. │  19   Ctrl-s      │   51    3  │  83    S  │  115    s  │  147    ô  │
  5466. │  20   Ctrl-t      │   52    4  │  84    T  │  116    t  │  148    ö  │
  5467. │  21   Ctrl-u      │   53    5  │  85    U  │  117    u  │  149    ò  │
  5468. │  22   Ctrl-v      │   54    6  │  86    V  │  118    v  │  150    û  │
  5469. │  23   Ctrl-w      │   55    7  │  87    W  │  119    w  │  151    ù  │
  5470. │  24   Ctrl-x      │   56    8  │  88    X  │  120    x  │  152    ÿ  │
  5471. │  25   Ctrl-y      │   57    9  │  89    Y  │  121    y  │  153    Ö  │
  5472. │  26   Ctrl-z      │   58    :  │  90    Z  │  122    z  │  154    Ü  │
  5473. │  27   Ctrl-[ Esc  │   59    ;  │  91    [  │  123    {  │  155    ¢  │
  5474. │  28   Ctrl-\      │   60    <  │  92    \  │  124    |  │  156    £  │
  5475. │  29   Ctrl-]      │   61    =  │  93    ]  │  125    }  │  157    ¥  │
  5476. │  30   Ctrl-^      │   62    >  │  94    ^  │  126    ~  │  158    ₧  │
  5477. │  31   Ctrl-_      │   63    ?  │  95    _  │  127   DEL │  159    ƒ  │
  5478. └───────────────────┴────────────┴───────────┴────────────┴────────────┘
  5479.  
  5480. ┌──────────┬───────────┬───────────┬───────────┬───────────┬───────────┐
  5481. │ Dec Char │ Dec  Char │ Dec  Char │ Dec  Char │ Dec  Char │ Dec  Char │
  5482. ├──────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
  5483. │ 160   á  │ 176    ░  │ 192    └  │ 208    ╨  │ 224    α  │ 240    ≡  │
  5484. │ 161   í  │ 177    ▒  │ 193    ┴  │ 209    ╤  │ 225    ß  │ 241    ±  │
  5485. │ 162   ó  │ 178    ▓  │ 194    ┬  │ 210    ╥  │ 226    Γ  │ 242    ≥  │
  5486. │ 163   ú  │ 179    │  │ 195    ├  │ 211    ╙  │ 227    π  │ 243    ≤  │
  5487. │ 164   ñ  │ 180    ┤  │ 196    ─  │ 212    ╘  │ 228    Σ  │ 244    ⌠  │
  5488. │ 165   Ñ  │ 181    ╡  │ 197    ┼  │ 213    ╒  │ 229    σ  │ 245    ⌡  │
  5489. │ 166   ª  │ 182    ╢  │ 198    ╞  │ 214    ╓  │ 230    µ  │ 246    ÷  │
  5490. │ 167   º  │ 183    ╖  │ 199    ╟  │ 215    ╫  │ 231    τ  │ 247    ≈  │
  5491. │ 168   ¿  │ 184    ╕  │ 200    ╚  │ 216    ╪  │ 232    Φ  │ 248    °  │
  5492. │ 169   ⌐  │ 185    ╣  │ 201    ╔  │ 217    ┘  │ 233    Θ  │ 249    ∙  │
  5493. │ 170   ¬  │ 186    ║  │ 202    ╩  │ 218    ┌  │ 234    Ω  │ 250    ·  │
  5494. │ 171   ½  │ 187    ╗  │ 203    ╦  │ 219    █  │ 235    δ  │ 251    √  │
  5495. │ 172   ¼  │ 188    ╝  │ 204    ╠  │ 220    ▄  │ 236    ∞  │ 252    ⁿ  │
  5496. │ 173   ¡  │ 189    ╜  │ 205    ═  │ 221    ▌  │ 237    φ  │ 253    ²  │
  5497. │ 174   «  │ 190    ╛  │ 206    ╬  │ 222    ▐  │ 238    ε  │ 254    ■  │
  5498. │ 175   »  │ 191    ┐  │ 207    ╧  │ 223    ▀  │ 239    ∩  │ 255 Blank │
  5499. └──────────┴───────────┴───────────┴───────────┴───────────┴───────────┘
  5500. NOTE: Upper ASCII characters (above 127) can be formed by holding the Alt 
  5501. key down while spelling out the decimal value on the number pad.  When 
  5502. the Alt key is released, the ASCII character will be displayed.  See the 
  5503. documentation for your text editor for the method it uses to enter control 
  5504. and upper ASCII values.
  5505.                              Scan Code Table(1)
  5506.  
  5507. Extended and enhanced keys are recognized by their scan codes.  This 
  5508. scan code table lists all known scan codes for the 101 enhanced 
  5509. keyboard.  GET C and GET T use the upper ASCII characters as 
  5510. surrogates for some of the extended and enhanced keys.  GET forms 
  5511. these surrogates for many of the scan codes in the range of 28 through 
  5512. 150 by adding 100 to the scan code and using the corresponding upper 
  5513. ASCII character.  For example, the scan code for F1 is 59.  This would 
  5514. be confused with the ASCII character <;>, so GET adds 100 to it and 
  5515. uses code 159 which is represented by the upper ASCII character <ƒ>.
  5516.  
  5517. ┌────────────────┬─────────────────┬────────────────┬────────────────────┐
  5518. │ Code  Key      │ Code  Key       │ Code  Key      │ Code   Key         │
  5519. ├────────────────┼─────────────────┼────────────────┼────────────────────┤
  5520. │  1    Esc      │ 43    Alt-\/|   │  85   Shift-F2 │ 127    Alt-8       │
  5521. │  2    1/!      │ 44    Alt-z     │  86   Shift-F3 │ 128    Alt-9       │
  5522. │  3    2/@      │ 45    Alt-x     │  87   Shift-F4 │ 129    Alt-0       │
  5523. │  4    3/#      │ 46    Alt-c     │  88   Shift-F5 │ 130    Alt--       │
  5524. │  5    4/$      │ 47    Alt-v     │  89   Shift-F6 │ 131    Alt-=       │
  5525. │  6    5/%      │ 48    Alt-b     │  90   Shift-F7 │ 132    CtrlPgUp    │
  5526. │  7    6/^      │ 49    Alt-n     │  91   Shift-F8 │ 133    F11         │
  5527. │  8    7/&      │ 50    Alt-m     │  92   Shift-F9 │ 134    F12         │
  5528. │  9    8/*      │ 51    Alt-,/<   │  93   Shift-F10│ 135    Shift-F11   │
  5529. │ 10    9/(      │ 52    Alt-./>   │  94   Ctrl-F1  │ 136    Shift-F12   │
  5530. │ 11    0/)      │ 53    Alt-//?   │  95   Ctrl-F2  │ 137    Ctrl-F11    │
  5531. │ 12    -/_      │ 54    RightShift│  96   Ctrl-F3  │ 138    Ctrl-F12    │
  5532. │ 13    =/+      │ 55    Grey*     │  97   Ctrl-F4  │ 139    Alt-F11     │
  5533. │ 14    BkSp     │ 56    LeftAlt   │  98   Ctrl-F5  │ 140    Alt-F12     │
  5534. │ 15    Tab      │ 57    Space     │  99   Ctrl-F6  │ 141    CtrlUp      │
  5535. │ 16    Alt-q    │ 58    CapsLock  │ 100   Ctrl-F7  │ 142    CtrlGrey-   │
  5536. │ 17    Alt-w    │ 59    F1        │ 101   Ctrl-F8  │ 143    Ctrl-Num5   │
  5537. │ 18    Alt-e    │ 60    F2        │ 102   Ctrl-F9  │ 144    CtrlGrey+   │
  5538. │ 19    Alt-r    │ 61    F3        │ 103   Ctrl-F10 │ 145    CtrlDown    │
  5539. │ 20    Alt-t    │ 62    F4        │ 104   Alt-F1   │ 146    CtrlIns     │
  5540. │ 21    Alt-y    │ 63    F5        │ 105   Alt-F2   │ 147    CtrlDel     │
  5541. │ 22    Alt-u    │ 64    F6        │ 106   Alt-F3   │ 148    CtrlTab     │
  5542. │ 23    Alt-i    │ 65    F7        │ 107   Alt-F4   │ 149    CtrlGrey/   │
  5543. │ 24    Alt-o    │ 66    F8        │ 108   Alt-F5   │ 150    CtrlGrey*   │
  5544. │ 25    Alt-p    │ 67    F9        │ 109   Alt-F6   │ 151    AltGreyHome │
  5545. │ 26    [/{      │ 68    F10       │ 110   Alt-F7   │ 152    AltGreyUp   │
  5546. │ 27    ]/}      │ 69    NumLock   │ 111   Alt-F8   │ 153    AltGreyPgUp │
  5547. │ 28    Alt-Enter│ 70    ScrollLock│ 112   Alt-F9   │ 154                │
  5548. │ 29    LeftCtrl │ 71    Home      │ 113   Alt-F10  │ 155    AltGreyLeft │
  5549. │ 30    Alt-a    │ 72    Up        │ 114   CtrlPrtSc│ 156                │
  5550. │ 31    Alt-s    │ 73    PgUp      │ 115   CtrlLeft │ 157    AltGreyRight│
  5551. │ 32    Alt-d    │ 74    Grey-     │ 116   CtrlRight│ 158                │
  5552. │ 33    Alt-f    │ 75    Left      │ 117   CtrlEnd  │ 159    AltGreyEnd  │
  5553. │ 34    Alt-g    │ 76    Num5      │ 118   CtrlPgDn │ 160    AltGreyDown │
  5554. │ 35    Alt-h    │ 77    Right     │ 119   CtrlHome │ 161    AltGreyPgDn │
  5555. │ 36    Alt-j    │ 78    Grey+     │ 120   Alt-1    │ 162    AltGreyIns  │
  5556. │ 37    Alt-k    │ 79    End       │ 121   Alt-2    │ 163    AltGreyDel  │
  5557. │ 38    Alt-l    │ 80    Down      │ 122   Alt-3    │ 164    AltGrey-/   │
  5558. │ 39    Alt-;/:  │ 81    PgDn      │ 123   Alt-4    │ 165    AltTab      │
  5559. │ 40    Alt-'/"  │ 82    Ins       │ 124   Alt-5    │ 166    AltGreyEnter│
  5560. │ 41    Alt-`/~  │ 83    Del       │ 125   Alt-6    │                    │
  5561. │ 42    LeftShift│ 84    Shift-F1  │ 126   Alt-7    │                    │
  5562. └────────────────┴─────────────────┴────────────────┴────────────────────┘
  5563. (1)To use extended and enhanced keys with GET C and GET T, add 100 to 
  5564. the scan code. Many of scan codes 28 through 150 are recognized as 
  5565. surrogates 128 through 250. To use extended and enhanced keys with GET 
  5566. U, add 255 to the scan code. Many of scan codes 28 through 150 are 
  5567. recognized as surrogates 283 through 405.